0

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

2
Contributors
1
Reply
3
Views
8 Years
Discussion Span
Last Post by debasisdas
0

try using this

con.Begintrans    'con is ADODB connection ojbect
con.execute "your insert /  update statment here'
con.committrans
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.