我想创建通过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