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();

Jignesh TrivediPosted Mar 27, 2012, 12:16 AM
try,
DataSet dset =new DataSet();
SqlConnection con = new SqlConnection(@"Data Source=KBBALOCH-PC\HIDAYA; Database=mydb;Integrated Security=true;");
con.Open();
string query = "select * from Table_1";
SqlDataAdapter adp = new SqlDataAdapter(query, con);
adp.Fill(dset);
DropDownList1.DataSource = dset;
DropDownList1.DataBind();
DropDownList1.DataTextField = "name";
DropDownList1.DataValueField = "f_name";
hope this help.