Mfwamba Tshimanga

Mfwamba Tshimanga

  • NA
  • 155
  • 46.4k

Textbox don't show numeric datas only character one...

May 22 2014 4:33 AM
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();
}
 

Answers (3)