Pls need urgent respond to Inserting Record Into the Database

Reply

Join Date: Jul 2007
Posts: 56
Reputation: atplerry is an unknown quantity at this point 
Solved Threads: 3
atplerry atplerry is offline Offline
Junior Poster in Training

Pls need urgent respond to Inserting Record Into the Database

 
0
  #1
Aug 6th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,305
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 147
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Nearly a Posting Maven

Re: Pls need urgent respond to Inserting Record Into the Database

 
0
  #2
Aug 6th, 2008
try using this

  1. con.Begintrans 'con is ADODB connection ojbect
  2. con.execute "your insert / update statment here'
  3. con.committrans
  4.  
Share your Knowledge.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum


Views: 452 | Replies: 1
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC