CODBE in .NET

lavakumarlavakumar Member Posts: 21
I am trying to update a table using CODBC connection in .NET. I am able to connect to Navision Database and with the following Code

string mySelectQuery = "SELECT * from <Table Name>";
OdbcConnection conODBC = new OdbcConnection("DSN=Cronus_Connect");
OdbcCommand myCommand = new OdbcCommand(mySelectQuery,conODBC);
conODBC.Open();

OdbcDataReader myReader = myCommand.ExecuteReader();
while (myReader.Read())
{ }
This works fine and I am able to read the rows in the database.

Now If I try to update the database with the following code
string mySelectQuery = "Update <Table Name> SET <Col. Name> = 'Something' Where <Col Name> = 'SomeValue'"

OdbcConnection conODBC = new OdbcConnection("DSN=Cronus_Connect");

OdbcCommand myCommand = new OdbcCommand(mySelectQuery,conODBC);
conODBC.Open();
myCommand.ExecuteNonQuery(); :cry:
Now If I run the program it gives me an error that
Driver does not support this function

I checked all the documentation and Microsoft.Data.ODBC does support EcecuteNonQuery function.

Can any one help me through. This is the first time I am working on Navision.

Thanks

Kumar
Sign In or Register to comment.