将值从gridview插入数据库 [英] insert value from gridview into database

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

问题描述

我将其加载到c#中的创建列中
像这样

I have this in form load to creat column in c#
like this

dataGridView1.Columns.Add("", "name");
            dataGridView1.Columns.Add("", "Address");
            dataGridView1.Columns.Add("", "gender");



现在,如果我在行中写值

我想将此行插入到数据库中,然后在保存按钮中添加什么代码



now if i write value in the rows

i want to insert this rows to database what the code will be in the save button

推荐答案

尝试
通过分页在Datagridview中添加,编辑和更新 [ csharp-tutorial-binding-a-datagridview-to-a-数据库 [
Try out
Add,Edit and Update in Datagridview with paging[^]
csharp-tutorial-binding-a-datagridview-to-a-database[^]


检查类似的问题和解决方案.

如何在GridView中插入数据,然后进入数据库 [ ^ ]
Check similar question and the solution.

How to insert data in GridView and then into database[^]


您可以使用TableAdapter
的Update方法 看到这个
使用DataGridView更新数据库
You can use Update method of TableAdapter
see this
DataBase Updation With DataGridView


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

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