Hi!
I have these code and when I make filter its show me data in my textbox (only character one. Not numeric one). How can I resolv it please?
This is the structure of my database:
Name Data Type
First_name Varchar(30)
Code numeric(18,0)
{
string connectionString = @"Data Source=localhost\sqlexpress;Initial Catalog=master;Integrated Security=True";
SqlConnection sqlCon = new SqlConnection(connectionString);
sqlCon.Open();
string commandString = "select first_name, code from company where code='" + codesearch.Text + "'";
SqlCommand sqlCmd = new SqlCommand(commandString, sqlCon);
SqlDataReader read = sqlCmd.ExecuteReader();
while (read.Read())
{
showfirstname.Text = read["first_name"].ToString();// Here it's right
showcode.Text = read["code"].ToString();// The problem it's here
}
sqlCon.Close();
}

Anupam SinghRank #643 · 3.7K reputationPosted May 22, 2014, 12:42 AM EDT
if yes the it might be cause of it.
else you should try debugging..
Ranjit PowarRank #553 · 4.4K reputationPosted May 22, 2014, 12:44 AM EDT
VulpesRank #55 · 29.2K reputationPosted May 22, 2014, 1:03 AM EDT
string commandString = "select first_name, code from company where code = " + codesearch.Text;