Comparing textbox value to database
Posted
by simon
on Stack Overflow
See other posts from Stack Overflow
or by simon
Published on 2010-05-05T20:27:44Z
Indexed on
2010/05/05
20:38 UTC
Read the original article
Hit count: 166
HI ! I would like to compare values from a textbox with data from a table. I tried this code but i got the error that the input string was in the wrong format! code:
string connectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=save.mdb";
try
{
database = new OleDbConnection(connectionString);
database.Open();
string queryString = "SELECT zivila.naziv,users.user_name FROM (obroki_save "
+ " LEFT JOIN zivila ON zivila.ID=obroki_save.ID_zivila) "
+ " LEFT JOIN users ON users.ID=obroki_save.ID_uporabnika "
+ " WHERE users.ID='" +Convert.ToInt16(id.iDTextBox.Text)+"'";
loadDataGrid(queryString);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
© Stack Overflow or respective owner