您的位置:首页 > 数据库

C#读取数据库中的表

2015-08-27 00:21 288 查看
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;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: