| | |
Pls need urgent respond to Inserting Record Into the Database
![]() |
•
•
Join Date: Jul 2007
Posts: 56
Reputation:
Solved Threads: 3
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
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
try using this
vb Syntax (Toggle Plain Text)
con.Begintrans 'con is ADODB connection ojbect con.execute "your insert / update statment here' con.committrans
Share your Knowledge.
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: help me! to create list of data
- Next Thread: guyzz any idea in the Barcode Scanner?
Views: 452 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
6 7 2007 access activex ado append application array banned basic beginner box calculator cd client code coffeehouse column convert copy creative database datareport date delete designer desktop dissertations dissertationthesis dissertationtopic error excel file filter flex form game hardware ide image inboxinvb installation installer interaction key listbox liveperson measure metadata microsoft movingranges noob number object open oracle os outlook pause pdf picture pos print problem program programmer prompt query random range readfile reading refresh registration report save search size sort spectateswamp sql string struct table tags textbox time timer variable variables vb vb6 vb6.0 vba visual visualbasic web window windows






