table 创建时 AUTOINCREMENT 的“,”附近的语法不正确

Incorrect syntax near ',' on AUTOINCREMENT on table creation

我是数据库初学者,我正在做 AUTOINCREMENT 创建 table,但出现以下错误:

System.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near ','.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolea
n breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception
, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObj
ect stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand
 cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler,
TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName,
Boolean async, Int32 timeout, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSou
rce`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean
asyncWrite)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at KellenTechnology.Program.Main(String[] args) in c:\Users\Mohit\Documents\V
isual Studio 2013\Projects\KellenTechnology\KellenTechnology\Program.cs:line 39
ClientConnectionId:1629d6a5-8e66-445b-99b1-b009103d0343
♂Data base Connection Closed. 

我的代码是:

 string sqlStatement = "CREATE TABLE " + Table1Name + "" 
                    + "(network_id INTEGER PRIMARY KEY AUTOINCREMENT,"
                    + "network_full_name VARCHAR(50) NOT NULL)";

有人可以告诉我它有什么问题吗?我还在某个地方找到了 not null identity(1, 1) 而不是 autoincrement 但两者有何不同?

MS SQL-服务器的自动递增等效项称为identity:

string sqlStatement = "CREATE TABLE " + Table1Name + 
                    + "(network_id INTEGER NOT NULL IDENTITY(1,1) PRIMARY KEY,"
                    + "network_full_name VARCHAR(50) NOT NULL)";

为 SQL 服务器尝试这个从错误开始它是 Sql 服务器的错误

string sqlStatement = "CREATE TABLE " + Table1Name + "" 
                    + " (network_id INTEGER identity(1,1) PRIMARY KEY,"
                    + "network_full_name VARCHAR(50) NOT NULL)";

BEWARE OF SQL INJECTION