public class cTableCheck
{
public bool TableExist(string conString, string tableName)
{
MySqlConnection Con = new MySqlConnection(conString);
using (var cmd = new MySqlCommand())
{
cmd.Connection = Con;
var sql = string.Format("select count(*) from information_schema.TABLES where table_name = '{0}'", tableName);
cmd.CommandText = sql;
Con.Open();
var count = Convert.ToInt32(cmd.ExecuteScalar());
return (count > 0);
}
}
}
댓글 없음:
댓글 쓰기