Invalid Object name Exception

viethungtsn1

New Member
I have created a table named Customerdetails which contains all the information regarding customers such as customer_id,name contact,etc.. I have created one form in which once i enter the customer name all other details should get displayed automatically..Bt when i enter name in the name textbox ,i get exception as \[quote\] invalid object name Customerdetails.\[/quote\]I am developing this project in asp.net c#. Given below is my code sample..Your help will hugely appreciated.. thank you...!!\[code\] private void textBox2_TextChanged(object sender, EventArgs e) { con.Open(); SqlCommand cmd = new SqlCommand("select * from Customerdetails where name='"+textBox2.Text+"'",con); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { textBox1.Text = dr["customer_id"].ToString(); textBox2.Text = dr["name"].ToString(); textBox3.Text = dr["contact"].ToString(); richTextBox1.Text = dr["address"].ToString(); textBox4.Text = dr["veichle"].ToString(); textBox5.Text = dr["veichle_no"].ToString(); } con.Close(); }\[/code\]
 
Back
Top