English 中文(简体)
Visual C# 2008. CRUD Example using Dataset, DataRow with an Access Mdb
原标题:

I m using Visual Studio C# 2008
I ve created (visually) a dataset that points to a mdb file (Access 2007)
This DataSet is called "EstacionarDataSet"

EstacionarDataSet ed = new EstacionarDataSet();
DataRow newRow = ed.Tables[0].NewRow();
newRow["patente"] = tb_Patente.Text;
newRow["numerobox"] = tb_Box.Text;
newRow["fechahora_ingreso"] = DateTime.Now;
ed.Tables[0].Rows.Add(newRow);
  • This code is executed in a Form2 (not mainform), where I m trying to insert a new record into the only table mdb file has (this code doesn t work, but doesn t give any exception).

  • The mainform contains a System.Windows.Forms.DataGridView component, attached to this mdb file, which works fine, it shows the records correctly, etc. (PS: I added some sample records using Access)

  • I m needing some code samples for adding a new row, updating, and deleting... Thanks

最佳回答

You need to understand how DataAdapter works:

read this article

DataAdapter

or many other in the web.

Then All you need is a connection object to the MDB, A configured dataadapter with select insert and update commands (can be easily done with the wizard).

and fill a table or dataset with the data, binding it to the gridview.

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签