hi..i would like to ask whats wrong with this piece of code...
[code=vbnet]
int convertNumber;
string label, doID = "1";
label = doNumberLabel.T ext;
convertNumber = int.Parse(label );
string connection = "provider=Micro soft.jet.OLEDB. 4.0;Data source=" + Application.Sta rtupPath + "\\..\\..\\fypS tock.mdb; Jet OLEDB:Database Password=" + databasePasswor d;
OleDbConnection myConnection = new OleDbConnection (connection);
myConnection.Op en();
string query = @"update doNumber set Number= '" + convertNumber +
"' WHERE numberID = " + doID;
myCommand = new OleDbCommand();
myCommand.Comma ndText = query;
myCommand.Conne ction = myConnection;
myCommand.Execu teNonQuery();
myConnection.Cl ose();
[/code]
in the database, numberID is auto number and Number is Number.
what i'm trying to do id to get the value from label donumberlabel, then converrt it to string, then put the string into the database.
the error is it highlight the "myCommand.Exec uteNonQuery();" then says error on the update statement.
i'm using C#
please help
[code=vbnet]
int convertNumber;
string label, doID = "1";
label = doNumberLabel.T ext;
convertNumber = int.Parse(label );
string connection = "provider=Micro soft.jet.OLEDB. 4.0;Data source=" + Application.Sta rtupPath + "\\..\\..\\fypS tock.mdb; Jet OLEDB:Database Password=" + databasePasswor d;
OleDbConnection myConnection = new OleDbConnection (connection);
myConnection.Op en();
string query = @"update doNumber set Number= '" + convertNumber +
"' WHERE numberID = " + doID;
myCommand = new OleDbCommand();
myCommand.Comma ndText = query;
myCommand.Conne ction = myConnection;
myCommand.Execu teNonQuery();
myConnection.Cl ose();
[/code]
in the database, numberID is auto number and Number is Number.
what i'm trying to do id to get the value from label donumberlabel, then converrt it to string, then put the string into the database.
the error is it highlight the "myCommand.Exec uteNonQuery();" then says error on the update statement.
i'm using C#
please help
Comment