从datagridview插入SQL数据库 [英] Insert into SQL Database from datagridview

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

问题描述

大家好
希望有人能帮助我,我是视觉基础的新手,需要一点帮助.
我已经将一些数据从excel工作表导入到数据网格中,我正在努力做的是将该信息传递到sql数据库中,我已经创建了名为ImportInfo的表,并且数据库名为mydb.该datagridview称为DataGridView1
任何帮助将不胜感激

谢谢

Hi Everybody
Hope someone can help me, I am new to visual basic and need a bit of help.
I have imported some data from an excel sheet into a datagrid, what I am struggling to do is to pass this infomation into an sql database, I already have the table created called ImportInfo and the database is called mydb. The datagridview is called DataGridView1
Any help would be gratefully received

Thanks

推荐答案

希望,第一个数据将被加载到DataTable或DataSet
在将Datatable或DS分配给Datagridview时.

遍历DataTable或Dataset并插入记录.

Hope, First Data will be Loaded into DataTable or DataSet
While u r assigning Datatable or DS to Datagridview..

Loop Through DataTable or Dataset and insert the Records.

For Exa:
DGrid.Datasource=Dt;
for(int i=0;i<dt.rows.count;i++)
{
//stmts
}


某些链接-
http://www.codeproject.com/KB/database/VB_DGV_UpdatingBoundDB.aspx [ ^ ]
http://www.vbnettutorial.net/?Id=125&Desc=VB.Net- DataGridView [ ^ ]
Some links -
http://www.codeproject.com/KB/database/VB_DGV_UpdatingBoundDB.aspx[^]
http://www.vbnettutorial.net/?Id=125&Desc=VB.Net-DataGridView[^]


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

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