Options

c/odbc visual basic .net

aiserteaiserte Member Posts: 2
edited 2006-04-03 in Navision Financials
I am trying to update a table using CODBC connection in .NET.
I am able to connect to Navision Database and I am be able to read data


But If I try to update the database with the following code


Dim conStr As String = "DSN=Navi;CN=company;UID=user;CC=Yes;NType=tcp;RO=No;OPT=Text;BE=Yes;SName=ip;IT=All Characters;PPath=C:\program files\Navision Financials;QTYesNo=Yes;SERVER=N;CSF=Yes"

Dim myConnection As New OdbcConnection(conStr)
myConnection.Open()

Dim myCommand As OdbcCommand = myConnection.CreateCommand()


Try
Dim sql As String
sql = " INSERT INTO ""TABLE"""
sql = sql & " (""FIELD1"", ""FIELD2"", "
sql = sql & " ""FIELD3"", ""FIELD4"", "
sql = sql & " ""FIELD5"", ""FIELD6"", "
sql = sql & " ""FIELD7"", ""FIELD8"", "
sql = sql & " ""FIELD9"", ""FIELD10"", "
sql = sql & " ""FIELD11"", ""FIELD12"") "
sql = sql & " values ('27', '27', '27', '2006/03/16', '2006/03/16', 'b', 'c', 'd', 'e', 'f','g', 'USER' ) "
myCommand.CommandText = sql
myCommand.ExecuteNonQuery()
Catch ex As Exception
Try

Console.WriteLine("An exception of type " & ex.GetType().ToString() & _
"was encountered while inserting the data.")
Console.WriteLine("Neither record was written to database.")
Finally
myConnection.Close()
End Try



Now If I run the program it gives me an error that
Driver does not support this function

Although the data was inserted.

Can any one help me through

Thanks
Sign In or Register to comment.