在Visual Sttudio 2010和SQL 2008中进行Datagridview操作 [英] Datagridview Manipulation in Visual Sttudio 2010 and sql 2008

查看:75
本文介绍了在Visual Sttudio 2010和SQL 2008中进行Datagridview操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是编程新手.我在SQL 2008中有30列,并且表名为"Employee".我可以在Visual Studio 2010中使用datagridview查看sql表.我还可以添加新行并保存数据.但是无法更新该行.我需要编辑该行并将其重新保存在sql中.


对于示例

用DOB Mobile为名. (3列sql表)

我输入了empname"emp1",第二个emp名称"emp2".我单击保存",但无法保存.
然后运行我输入empname"emp3" DOB"26/7/1990"的项目,我可以保存.
我无法编辑"emp1" DOB列.
我无法将"emp3" DOB编辑为"1991年7月25日"

要保存,请使用

Hi,

Im new to programming. I have 30 columns in SQL 2008 and table named "Employee". Im able to view the sql table using datagridview in visual studio 2010.I also able to add a new row and save the data. But not able to update the row.I need to edit the row and save it agin in sql.


For Ex.

Empname DOB Mobile. (3 column sql table)

I entered empname "emp1", second emp name "emp2". I click save im able to save.
then I run the project I entered empname "emp3" DOB "26/7/1990", Im able to save.
I cannot edit "emp1" DOB column.
I cannot edit "emp3" DOB to "25/7/1991"

To save I use

DataGridView2.[ReadOnly] = False
      da.Update(ds.Tables("EMP"))



我得到的错误是

不返回任何键列信息的SelectCommand不支持为UpdateCommand动态生成SQL.



The error i got is

Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.

推荐答案

一些应该帮助您入门的链接-
http://www.dotnetperls.com/datagridview-tutorial [ http://www.dotnetperls.com/datagridview [ http://csharp.net-informations.com/datagridview/csharp-datagridview-tutorial.htm [^ ]
如何使用C#中的SQL语句填充DataGridView,GridView [ ^ ]

此处 [ ^ ]是视频.
Some links that should help you get started -
http://www.dotnetperls.com/datagridview-tutorial[^]
http://www.dotnetperls.com/datagridview[^]
http://csharp.net-informations.com/datagridview/csharp-datagridview-tutorial.htm[^]
How to populate DataGridView, GridView with SQL statement in C#[^]

Here[^] is a video.


这篇关于在Visual Sttudio 2010和SQL 2008中进行Datagridview操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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