CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Dec 2008
    Location
    Step Into(F11)
    Posts
    465

    Question editing listview using change button

    can anybody tell me why i got syntax error(missing operator) in query expression'ID='; here is the code what i have written.any help would be greatly appreciated.
    Code:
    Private Sub Command2_Click()
    If CheckInput = True Then
        Dim success As Boolean
        Set con = New ADODB.Connection
        success = OpenConnection(con)
     If success = False Then
          MsgBox ("Cannot Open Connection")
          Exit Sub
    End If
    Set rs = New ADODB.Recordset
    rs.Open "select * from supplierS where ID=" & Text1.Text, con, adOpenDynamic, adLockOptimistic
     If rs.BOF And rs.EOF Then rs.AddNew
     ' rs.Fields("Supplier_id") = Text1.Text
       rs.Fields("Supplier_name") = Text2.Text
       rs.Fields("contact_person") = Text3.Text
       rs.Fields("contact_no") = Text4.Text
       rs.Fields("office_address") = Text6.Text
       rs.Fields("emails") = Text7.Text
       rs.Fields("website") = Text8.Text
       rs.Fields("Fax_no") = Text5.Text
       rs.Fields("item_type") = Combo1.Text
       rs.Update
       MsgBox ("data saved")
       rs.Close
     Else
       Exit Sub
    End If
    con.Close
    Set con = Nothing
    End Sub
    Last edited by firoz.raj; December 27th, 2009 at 04:15 AM.

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

Featured