更新时间:2023-02-04 09:52:52
试试....string s =从Mst_Status_Common中选择Status_CommonName;
SqlDataAdapter sda = new SqlDataAdapter(s,connectionName);
DataSet ds = new DataSet();
Sda.Fill(ds);
DropDownListname.DataSource = ds;
DropDownListname.DataBind();
希望我理解你的问题.....
这些示例应该对您有用 -
http://www.java2s.com/Tutorial/ASP.NET/0360__ADO.net-Database/ReaddatafromSQLserverandfillaspdropdownlistC.htm [ ^ ]
http://www.dotnetspark.com/kb/51-data-populate-dropdownlist-through-sql-server。 aspx [ ^ ]
I am working with SQL SERVER 2008(sql server authentication) & visual studio 2010. I have some records in the database table named Mst_Status_Common. I want to get a particular column from the very database table to a drop down list. In the database table I have the columns as - Status_CommonId , Status_CommonName , Active_Status , EntryBy , EntryDate. I want to fetch the data from column Status_CommonName to a drop down list . Data in that particular column are: /CR/E/EN/R/T.
kindly help me with the coding in details.
try it....string s="select Status_CommonName from Mst_Status_Common"; SqlDataAdapter sda=new SqlDataAdapter(s,connectionName); DataSet ds=new DataSet(); Sda.Fill(ds); DropDownListname.DataSource=ds; DropDownListname.DataBind();
hope that i understood ur question.....
These examples should be useful to you -
http://www.java2s.com/Tutorial/ASP.NET/0360__ADO.net-Database/ReaddatafromSQLserverandfillaspdropdownlistC.htm[^]
http://www.dotnetspark.com/kb/51-data-populate-dropdownlist-through-sql-server.aspx[^]