我試圖通過C#創建一個數據庫,而不使用SMO,這有可能嗎?!我目前有這個,但我99%是錯的;有沒有辦法在MYSQL中創建數據庫,而不使用SMO在C#
connectionString2 = "SERVER=" + server + ";" + "DATABASE=master;"
+ "UID=" + uid + ";" + "PASSWORD=" + password + ";"
this.OpenConnection(); //Which opens the above connection
// The Lines array has stored the sql statements to create the databse
// and tables for that database
foreach (string line in lines)
{
create_database += line;
}
MySqlCommand cmd = new MySqlCommand(create_database, connection2);
cmd.ExecuteNonQuery();
實際上是否可以在不使用SMO的情況下做到這一點?
不確定你在說什麼類型的數據庫服務器。 SMO是MSSQL,但MySsqlCommand是MySQL ... – Sascha 2012-03-13 18:25:53
對不起,Sascha,標題錯誤! – r0bb077 2012-03-13 18:29:01
刪除我MSSQL的答案 – Sascha 2012-03-13 18:31:35