//判斷表是否存在
private string TableNull(string report_name)
{
//.........................................................modify 1..............................
string reportname = report_name;
SqlConnection myConnection = new SqlConnection(config);
string mySelectQuery = "select count(*) AS Expr1 from INFORMATION_SCHEMA.TABLES where table_name='" + reportname+"'";//判断表是否存在的SQL语句
SqlCommand myCommand = new SqlCommand(mySelectQuery, myConnection);
myConnection.Open();
if ((int)myCommand.ExecuteScalar() == 0)
{
myConnection.Close();
return "0";
}
else
{
myConnection.Close();
return "1";
}
}
.Net 的學習中
浙公网安备 33010602011771号