Home  >  Article  >  Database  >  不能将值NULL插入列'id',表'weibo.

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

WBOY
WBOYOriginal
2016-06-07 15:54:501637browse

使用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设置为"是"\

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn