|
-
August 5th, 2001, 03:17 PM
#1
VB Application
Hi There, I'm learning VB. I'm trying to write an application in Vb. To Add a record I've a code written as below. I'm not sure how exactly to write(insert) into database. Any help would be greatly appreciated. Thanks in advance.
Private Sub CmdSubmit_Click()
DataGrid1.Visible = True
Dim ctg As String
Dim des As String
Dim amount As Currency
Dim exdate As Date
Dim paymethod As String, ename As String
Dim checknum As Integer
Dim sqlExp As String
If (IsNumeric(txtAmount.Text)) Then
ctg = CmbCtg
des = txtDes.Text
exdate = txtDate.Text
paymethod = CmbPaymentMethod
ename = txtEntityName.Text
checknum = txtCheckNum.Text
amount = CInt(txtAmount.Text)
sqlExp = "INSERT INTO tblExpense ( Exp_Ctg, Exp_Description, Exp_Date, Exp_PaymentMethod, Exp_EntityName, Exp_Checknum, Exp_Amount )" + _
"Values ('" & ctg & "','" & des & "','" & exdate & "','" & paymethod & "','" & ename & "','" & checknum & "'," & amount & ")"
HOW DO i EXCUTE THIS QUERY????????
Adodc2.Refresh
DataGrid1.Refresh
End Sub
-
August 5th, 2001, 07:39 PM
#2
Re: VB Application
Dim adoCommand as new ADODB.Command
With adoCommand
.ActiveConnection = Adodc2
.CommandText = sqlExp
.CommandType = adCmdText
.Execute
End With
Andy Tower
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|