By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,666 Members | 1,413 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,666 IT Pros & Developers. It's quick & easy.

OleDbCommand Problem

P: n/a
Hi

I have the following Problem:

I have an Access DB.

Tablename: Formate;

TableColoumns: ID (=Numeric)
Name (=string)

I wrote a Console Application to SELECT, INSERT, UPDATE the Table.

string oleConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=.......\FormatTest.mdb";

string update = "UPDATE Formate SET Name = @text WHERE ID = 1";

OleDbConnection oleConnection = new OleDbConnection(oleConnectionString);

OleDbCommand oleCommand = new OleDbCommand(update,oleConnection);

oleCommand.Parameters.Add("@anyValueName",999);
oleCommand.Parameters.Add("@text","Test Entry");

try
{
oleConnection.Open();
oleCommand.ExecuteNonQuery();
}
catch(Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
if(oleConnection.State == ConnectionState.Open)
oleConnection.Close();
}

After that I looked into the Table and the Updatequery wrote 999 instead of
"Test Entry" in the Table.

I tried the same with the Sql Namespace and a Table in a SQL Server and the
Update was correct.

Has anybody an idea??
Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.