Smart    Lucky

Smart Lucky

  • NA
  • 555
  • 640.9k

Sql connection Error

Mar 26 2012 8:22 AM

Hi 

Can nay one tell me whenever i am connecting sqlserver with asp.net it is showing me an error asslembly could not loaded some thing like................?

And i am adding text and value from database in dropdownlist in this way but it is not showing me added values can nay one tell me where i have mistake.............?


con = new SqlConnection(@"Data Source=KBBALOCH-PC\HIDAYA; Database=mydb;Integrated Security=true;");
con.Open();
string query = "select * from Table_1";
cmd = new SqlCommand(query, con);
reader = cmd.ExecuteReader();
while (reader.Read())
{
 DropDownList1.DataTextField = reader["name"].ToString();
DropDownList1.DataValueField = reader["f_name"].ToString();
}
DropDownList1.DataBind();


Answers (1)