如何使用gridview将数据插入数据库。 [英] How do I insert data into database using gridview.?

查看:322
本文介绍了如何使用gridview将数据插入数据库。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在尝试在网格视图中插入,更新,编辑数据但我收到错误,





'/'应用程序中的服务器错误。



无法将值NULL插入列'ID',表'Login.dbo 。人';列不允许空值。 INSERT失败。

声明已被终止。



我尝试过:



GridView在asp.net中插入更新删除。但是没有插入数据

Hello,
I'm trying to insert,update,edit data in grid-view but I'm getting an error,


Server Error in '/' Application.

Cannot insert the value NULL into column 'ID', table 'Login.dbo.Person'; column does not allow nulls. INSERT fails.
The statement has been terminated.

What I have tried:

GridView insert update delete in asp.net.But the data is not getting inserted

推荐答案

确保datagridview行你提交的ID有一个值,这不能为空或NULL。

你能告诉我们你是如何保存到数据库的吗?
Make sure the datagridview row that you are committing has a value for ID, this can not be empty or NULL.
Can you tell us how you are saving to the database ?


这篇关于如何使用gridview将数据插入数据库。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆