Asp.net获取Access中现有表名

来源:互联网 发布:宠物之王-龙灵传说java 编辑:程序博客网 时间:2024/04/29 08:38
 protected void GetTable()
    
{
        
object[] restrictions = new object[] nullnullnull"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)
    
{
    }
 
原创粉丝点击