how will updat access db by vb6 ADODB
run time error 3251
current recordset does not support updating
Code:
Private Sub Add_Click()
' Creating Connection
Dim adoCon As ADODB.Connection
Set adoCon = New ADODB.Connection
Dim conString As String
conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\MobileService.mdb;User Id=Admin;Password=;"
adoCon.Open conString
' creating Querry
Dim ar As ADODB.Recordset
Set ar = New ADODB.Recordset
Dim sqlstr As String
sqlstr = "Select * FROM ServiceDetail"
ar.Open ("ServiceDetail"), adoCon
' "Select DLNAME FROM ServiceDetail", adoCon, adOpenForwardOnly, adLockReadwrite, adCmdText
ar.AddNew
ar.Fields("DLNAME") = Text1.Text
ar.Fields("MOBILE_MO") = Text2.Text
ar.Fields("PROBLEM") = Text3.Text
ar.Fields("CHRAGES") = Text4.Text
'ar.Fields("DATE_S") = Date + Time
ar.Update
MsgBox "data update success fulluy ............."
End Sub
Re: how will updat access db by vb6 ADODB
Thread moved to 'Database Development' forum (the 'VB6' forum is only meant for questions which don't fit in more specific forums)
Is there a reason you haven't even given us a hint about what the issue is? (such as telling us you got an error, and which line it occurred on)
Re: how will updat access db by vb6 ADODB
Try, replacing your line ---> ar.Open ("ServiceDetail"), adoCon
with :
Code:
ar.Open sqlstr, adoCon, adOpenDynamic, adLockOptimistic
And post as Si_the_geek says
JG