我想創建通過C# 表我使用下面的代碼出錯創建表
private void Login_Load(object sender, EventArgs e)
{
string connectionstring = "server=.;database=Student;Integrated Security=True";
SqlConnection conn = new SqlConnection(connectionstring);
string fee_table = @"
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'fees') AND type in (N'U')) CREATE TABLE user (user_name char(50),password char(50));";
conn.Open();
SqlCommand cmd = new SqlCommand(fee_table, conn);
cmd.ExecuteNonQuery();
}
但IAM獲得運行時錯誤語法錯誤附近用戶
嗨,你有什麼錯誤? – Haris
谷歌第一個「ms-sql語法錯誤附近的用戶」的結果是[this SO Q&A](http://stackoverflow.com/questions/20543395/c-sharp-syntax-error-near-table-name),它作爲[在MS SQL Server中創建保留字/關鍵字的表名]的副本關閉(http://stackoverflow.com/questions/695578/creating-table-names-that-are-reserved-words-keywords-在MS-SQL服務器)。請嘗試先搜索。 – CodeCaster
「user1」附近的語法不正確。 – Aman