Hi Experts,
I use Visual Studio 2005.
I want to retreive data into textboxes providing inputs at runtime. I used the following code.It works when if i provide input at design time but while providing the input at run time the following error message gets displayed.
"Syntax error converting the varchar value 'TextBox10.Text' to a column of data type int. "
Please do help me in this regard.
Thanks in advance.
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter("select * from success where au_id ='TextBox10.Text', "data source=.;initial catalog=joannes;user id=sa;password=joannes");
da.Fill(ds);
if (ds.Tables[0].Rows.Count >= 0)
{
TextBox1.Text = ds.Tables[0].Rows[Convert.ToInt32(TextBox10.Text)]["au_id"].ToString();
TextBox2.Text = ds.Tables[0].Rows[Convert.ToInt32(TextBox10.Text)]["au_lname"].ToString();
TextBox3.Text = ds.Tables[0].Rows[Convert.ToInt32(TextBox10.Text)]["au_fname"].ToString();
TextBox4.Text = ds.Tables[0].Rows[Convert.ToInt32(TextBox10.Text)]["phone"].ToString();
TextBox5.Text = ds.Tables[0].Rows[Convert.ToInt32(TextBox10.Text)]["address"].ToString();
TextBox6.Text = ds.Tables[0].Rows[Convert.ToInt32(TextBox10.Text)]["city"].ToString();
TextBox7.Text = ds.Tables[0].Rows[Convert.ToInt32(TextBox10.Text)]["state"].ToString();
TextBox8.Text = ds.Tables[0].Rows[Convert.ToInt32(TextBox10.Text)]["zip"].ToString();
TextBox9.Text = ds.Tables[0].Rows[Convert.ToInt32(TextBox10.Text)]["contract"].ToString();
}