Maison >base de données >tutoriel mysql >不能将值NULL插入列'id',表'weibo.

不能将值NULL插入列'id',表'weibo.

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBoriginal
2016-06-07 15:54:501843parcourir

使用SQL Server 2005 数据库做web的项目出现 :不能将值 NULL 插入列 id,表 weibo.dbo.myfriend;列不允许有空值。INSERT 失败。 错误提示: com.microsoft.sqlserver.jdbc.SQLServerException: at com.microsoft.sqlserver.jdbc.SQLServerException.makeFro

使用SQL Server 2005 数据库做web的项目出现 :不能将值 NULL 插入列 'id',表 'weibo.dbo.myfriend';列不允许有空值。INSERT 失败。

错误提示:

com.microsoft.sqlserver.jdbc.SQLServerException:

at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown Source)

错误原因:

在SQL Server 2005中建立myfriend是没有将id标示设置为"是"

解决办法:

如下图 将其Id设置为"是"\

 

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn