Forum : VB.net Insert Customer CodeSearch Forum

Forum Home > FlexODBC - ODBC Driver for DataFlex Embedded DBMS > FlexODBC Frequently Asked Questions

 New Topic 
 
 Post Reply 
[1]  
 VB.net Insert Customer Code 
 Author   Message 
  GeraldHendrix 
  
 Group: Members 
 Posts: 6 
 Joined: 2008-05-28 
 Profile
 Posted : 2008-06-11 03:01:35

I'm not sure what I'm doing wrong here.  I am trying to insert into the Quickbooks Customer file using your example person with with VB.NET:

Try

Dim cnIns As New OdbcConnection

cnIns.ConnectionString = ("DSN=HaneyOne")

Dim commIns As OdbcCommand

commIns = New OdbcCommand("Insert into Customer(Name,LastName,FirstName,BillAddressAddr1,BillAddressCity,BillAddressState,BillAddressPostalcode)Values('Zuniga, Daphne','Zuniga','Daphne','561 W 4th St.','Carlsbad','CA','92009'", cnIns)

cnIns.Open()

CommIns.ExecuteNonQuery()

cnIns.Close()

Catch ex As Exception

Me.lblInsMsg.Text = "Error: " & ex.ToString()

End Try

lblInsMsg.Text = "Insert Successful"

I am getting the error:  ERROR [42000] [QODBC] Expected lexical element not found.  What am I missing?

 

  Top 
  Tom Aczel 
  dd4bf_dawworld.jpg
 Group: Administrator 
 Posts: 6281 
 Joined: 2006-02-17 
 Profile
 Posted : 2008-06-11 10:16:46

The values are missing the closing )

commIns = New OdbcCommand("Insert into Customer(Name,LastName,FirstName,BillAddressAddr1,BillAddressCity,BillAddressState,BillAddressPostalcode)Values('Zuniga, Daphne','Zuniga','Daphne','561 W 4th St.','Carlsbad','CA','92009')", cnIns)

 

  Top 
  GeraldHendrix 
  
 Group: Members 
 Posts: 6 
 Joined: 2008-05-28 
 Profile
 Posted : 2008-06-12 00:16:09
Thank you. 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to