mysql测试数据库是否创建成功_C#怎样判断MySQL表是否创建成功

在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();

展开


版权声明:本文为weixin_32296621原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。