当前位置:Gxlcms > 数据库问题 > C#读取数据库中的表

C#读取数据库中的表

时间:2021-07-01 10:21:17 帮助过:2人阅读

        private int ExistOrNot(string name)    //判断当前数据表是否存在

        {

            con = new SqlConnection(s);

            DataSet ds = new DataSet();

            string strSQL = "select name from sysobjects where type=‘" + ‘U‘ + "‘";

            sda = new SqlDataAdapter(strSQL, con);

            sda.Fill(ds);

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)

            {

                if (ds.Tables[0].Rows[i][0].ToString() == name)

                {

                    return 1;

                }

            }

            return 0;

        }

C#读取数据库中的表

标签:

人气教程排行