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 SinghPosted May 22, 2014, 4:42 AM
if yes the it might be cause of it.
else you should try debugging..
VulpesPosted May 22, 2014, 5:03 AM
string commandString = "select first_name, code from company where code = " + codesearch.Text;
Ranjit PowarPosted May 22, 2014, 4:44 AM