更新时间:2022-04-23 02:40:33
这是获取数据库中所有表的查询.
This is the query to get all the tables in a database.
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = ''BASE TABLE''
或
or
SELECT * FROM sys.tables
我希望您知道如何绑定到DropDownList [
I hope you know how to bind to DropDownList[^].
在低位中取了一个表名REG和FieldName Stu_Name.you根据您的数据库.
In the loweri have taken one table name REG and FieldName Stu_Name.you take as according to your database.
SqlConnection cn = new SqlConnection("PUT CONNECTION HERE");
SqlDataAdapter ad;
DataSet ds = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
ad = new SqlDataAdapter("Select * from REG", cn);
ad.Fill(ds, "REG");
DropDownList1.DataSource = ds.Tables[0];
DropDownList1.DataTextField = ds.Tables[0].Columns["Stu_Name"].ColumnName.ToString();
DropDownList1.DataValueField = ds.Tables[0].Columns["Stu_Name"].ColumnName.ToString();
DropDownList1.DataBind();
}
您的意思是哪个数据库?
像MySql或MS-SQL或Oracle
Which database u mean?
like MySql or MS-SQL or Oracle