首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

建立資料表時出錯解决方案

2012-02-21 
建立資料表時出錯建立資料表時出錯?????C# codestring connString WebConfigurationManager.ConnectionS

建立資料表時出錯
建立資料表時出錯 ?????

C# code
        string connString = WebConfigurationManager.ConnectionStrings["CnString"].ConnectionString;        SqlConnection conn = new SqlConnection(connString);        conn.Open();        string SQL =("CREATE TABLE a (Id int NOT NULL ," + "Name varchar (30)," + "Subbranch varchar(30)," + "ErrorCode varchar(5)");               SqlCommand objCommand = new SqlCommand(SQL, conn);        objCommand.ExecuteNonQuery();                conn.Close();        conn.Dispose();


結果 :  
接近 ')' 之處的語法不正確 
  objCommand.ExecuteNonQuery();






      


[解决办法]
不懂了?你这句话:string SQL =("CREATE TABLE a (Id int NOT NULL ," + "Name varchar (30)," + "Subbranch varchar(30)," + "ErrorCode varchar(5)");一前一后干嘛要用一个括号啊?把括号去掉......
[解决办法]
创建语句少了一个右括号
[解决办法]
string SQL =("CREATE TABLE a (Id int NOT NULL ," + "Name varchar (30)," + "Subbranch varchar(30)," + "ErrorCode varchar(5)");

==》


string SQL =("CREATE TABLE a (Id int NOT NULL ," + "Name varchar (30)," + "Subbranch varchar(30)," + "ErrorCode varchar(5))");

热点排行