Pls need urgent respond to Inserting Record Into the Database
I have a problem inserting record into the database collecting the data from textbox and combobox and inserting it to the database but i have been getting error for the past few hou that i have been trying to deug it but the error it giving me is
Private Sub Command1_Click()
Dim conConnection As New adodb.Connection
Dim cmdCommand As New adodb.Command
Dim rstRecordset As New adodb.Recordset
Dim strSQL As String
Dim cmd As sqlcommand
conConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\" & "MedicalCheck.mdb;mode=read"
conConnection.Open
With cmdCommand
.ActiveConnection = conConnection
.CommandText = "INSERT INTO Logininfo VALUES ('" & textbox1.Text & " ','" & textbox2.Text & "')"
.CommandText = "insert into emp values( ' " & textbox1.Text & " ', " & textbox2.Text & "')"
cmd.executeNonQuery()
Response.write (" One record inserted")
.CommandType = adCmdText
End With
With rstRecordset
.CursorType = adOpenStatic
.CursorLocation = adUseClient
.LockType = adLockBatchOptimistic
.Open cmdCommand
' .Update
End With
MsgBox ("Record Inserted")
End Sub
I could not get result to the problem
atplerry
Junior Poster in Training
58 posts since Jul 2007
Reputation Points: 10
Solved Threads: 3
try using this
con.Begintrans 'con is ADODB connection ojbect
con.execute "your insert / update statment here'
con.committrans
debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434