Results 1 to 3 of 3

Thread: how will updat access db by vb6 ADODB

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2010
    Posts
    24

    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
    Last edited by Akintex; Feb 8th, 2011 at 07:11 AM.

    My Code Project
    Gsm Flashing cable finder

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    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)

  3. #3
    Frenzied Member
    Join Date
    May 2006
    Location
    some place in the cloud
    Posts
    1,886

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width