从C#更新任何选定的表 [英] Update Any Selected Table from C#

查看:49
本文介绍了从C#更新任何选定的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想更新任何选定的表(* .Mdb文件).
我正在C#中工作,我需要吗?实际上是当我单击窗体中的打开"时,它将打开一个Dialouge框来浏览和仅打开Mdb文件.在该表单中,我保留了一个ComboBox,该ComboBox显示该特定Access文件中存在的表数,如果我们单击Any table,它将打开并将其显示在dataGrid上.

我需要的是,如果我们对DataGrid中的转换数据进行了任何更改,它应该反映在主数据库上,任何人都可以帮助我吗?????



P.Rupesh
rupesh.prince@gmail.com

Hi,
i want to update any selected Table (*.Mdb File).
I am working on it in C#,wat i need Actually is when i click on open in my form it will open a dialouge box to Browse And Open Only Mdb files. i that form i kept one ComboBox Which Shows The Number Of tables Present in that particular Access Files ,if we Click on Any table it will open And will Show it on a dataGrid.

Wat i need is if We made Any Changes In the Slected Data in our DataGrid It should Reflect On the Main DataBase,Can AnyOne Help Me???????



P.Rupesh
rupesh.prince@gmail.com

推荐答案

您应该拥有可用的表名,因此应该能够动态构造insert/update/delete语句.此外,如果使用dataadaptor填充网格的数据集,则该数据适配器可以从所使用的select语句中生成insert/update/and delete语句.

但是,如果我能指出的话,重新创建用于打开,mdb文件和在网格中编辑数据的Access默认应用程序功能的目的是什么?
As you should have the table name available you should be able to dynamically construct the insert/update/and delete statements. Additionally, if you used a dataadaptor to fill the dataset for the grid, that dataadaptor can generate insert/update/and delete statements from the select statement used.

However, if I may point out, what is the point of recreating the Access default Application functionality for opening, mdb files, and editing the data in a grid?


是的,您可以使用DataTable和dataAdapter就像我们的朋友在上一篇文章中所说.

使用它像DataAdapter.Update(DataTable);

如果您希望我们提供更好的支持,请让我们更多地了解您的代码.您是如何填充数据网格的?您使用适配器吗?等...


---------------------
问候

H.Maadani
yup, you can use DataTable and dataAdapter as our friend said in last post.

use it like DataAdapter.Update(DataTable);

let us know more about your code if you want us to provide better support. how did you fill the datagrid? do you use an adapter? etc...


---------------------
Regards

H.Maadani


这篇关于从C#更新任何选定的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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