在C#中动态生成数据库表,请问怎样判断表是否创建成功?用的是MySQL。stringcreateTables="create语句";OdbcConnectionmyConnection=newOdbcConnection(con);try{myConnection.Open()...
在C#中动态生成数据库表,请问怎样判断表是否创建成功?用的是MySQL。
string createTables = "create语句";
OdbcConnection myConnection = new OdbcConnection(con);
try
{
myConnection.Open();
}
catch (SqlException ex)
{
Console.WriteLine("Error accessing the database:{0}", ex.Message);
}
OdbcCommand inse = new OdbcCommand(createTables, myConnection);
try
{
int rest=inse.ExecuteNonQuery();
// ?????????
}
catch (System.Exception ex)
{
Console.WriteLine("{0}", ex.Message);
}
finally
{
inse.Dispose();
}
myConnection.Close();
展开