TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rao Varrey
NA
56
3.1k
Error when trying to save updated fields to Access database
Oct 1 2017 11:04 PM
private void button1_Click(object sender, EventArgs e)
{
// Saves changes made in the details
OdbcConnection myConnection = new OdbcConnection();
OdbcCommand cmd = myConnection.CreateCommand();
string myConnectionString = @"Driver={Microsoft Access Driver (*.mdb)};" + "Dbq=C:/DROPS-Data/Derrick.mdb";
{
myConnection.ConnectionString = myConnectionString;
//execute queries, etc
cmd.CommandText = "UPDATE InspInfo SET CompanyName = @cName, CustomerRef = @cRef Where WONo = @WO";
cmd.Parameters.AddWithValue("@cName",textBox1.Text);
cmd.Parameters.AddWithValue("@cRef", textBox2.Text);
cmd.Parameters.AddWithValue("@WO", textBox6.Text);
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
}
}
Error message
System.Data.Odbc.OdbcException (0x80131937): ERROR [07002] [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 3.
Can somebody help please
Reply
Answers (
6
)
Anonymous Type vs Anonymous Variable in C#
Cant get 2 datatable values in a crystal report