Project - add delete edit and search in local data base. Everything works perfectly apart from search.
All file names are the same just so confused. Don't really know anything about C# so probably something really daft.
Any help would be hugely appreciated.
The error
Cannot convert 'string' to 'int'
shows at the commented lines.
private void button4Search_Click(object sender, EventArgs e)
{
SqlDataReader mdr;
string select = "SELECT * FROM users WHERE id = " + textBoxID.Text;
command = new SqlCommand(select, connection);
openConnection();
mdr = command.ExecuteReader();
if (mdr.Read())
{
// ERRORS HERE
textBoxFileName.Text = mdr.GetString("FileName");
textBoxFilePath.Text = mdr.GetString("FilePAth");
textBoxMediaFileType.Text = mdr.GetString("MediaFileType");
textBoxComments.Text = mdr.GetString("Comments");
}
else
{
MessageBox.Show("User Not Found");
}
closeConnection();
}