急啊!!!ASP.NET数据库连接问题
各位帮我看看下面代码:
SqlConnection connection = new SqlConnection(@"Data Source=.\sqlexpress;AttachDbFilename=E:\leaning\C #Lean\C#Project\WebSite2\App_Data\Users.mdf;Integrated Security=True");
SqlDataAdapter thisAdapter = new SqlDataAdapter("SELECT * FROM User", connection);
SqlCommandBuilder thisBuilder = new SqlCommandBuilder(thisAdapter);
DataSet thisDataSet = new DataSet();
thisAdapter.Fill(thisDataSet, "User");
运行是总提示: 关键字 'User' 附近有语法错误
请问是什么原因
------解决方案--------------------[User]
------解决方案--------------------对应该用[User]
因为user在sql中是关键字
------解决方案--------------------user是关键字 加上[User]试试
con.open