protected void GetTable()
...{
object[] restrictions = new object[] ...{ null, null, null, "TABLE" }; //
OleDbConnection getTableConn = new OleDbConnection(CgetConnStr.connString);
getTableConn.Open();
DataTable tempTable = getTableConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,restrictions);
ArrayList TableName = new ArrayList();
int count = tempTable.Rows.Count;
for (int i = 0; i < count; i++)
...{
TableName.Add(tempTable.Rows[i]["TABLE_NAME"].ToString());
TextBox tempTb = new TextBox();
tempTb.ID = "tb" + i.ToString();
tempTb.Text = (string)TableName[i];
this.Controls.Add(tempTb);
}
getTableConn.Close();
}
public override void VerifyRenderingInServerForm(Control control)
...{
}
本文介绍了一种使用 OleDbConnection 从数据库中检索表结构的方法,并展示了如何利用 GetOleDbSchemaTable 方法来获取所有表名,最后将这些表名显示在 Web 页面上。
767

被折叠的 条评论
为什么被折叠?



