首页 > 编程 > .NET > 正文

Asp.net获取Access中现有表名

2024-07-10 13:05:40
字体:
来源:转载
供稿:网友


 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)
    {
    }

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表