Comparing textbox value to database
- by simon
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;
}