English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

this is a code to add data in the datagrid:

Private Sub btnAddSupplier_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddSupplier.Click
btnAddSupplier.Text = "Update Suppliers"
Dim ds As DataSet
If btnAddSupplier.Text = "Update Suppliers" Then
DataGrid1.ReadOnly = False
OleDbSuppliers.TableMappings.Add("Table", "SuppliersInfo")
OleDbSuppliers.Fill(ds, "SuppliersInfo")
DataGrid1.SetDataBinding(ds, "SuppliersInfo")
End If
End Sub

An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll

Additional information: The DataTableMapping.SourceTable is required to be unique, 'Table' already exists in the collection.

How to correct this??

2006-08-03 03:08:15 · 2 answers · asked by braich_gal 3 in Computers & Internet Programming & Design

If this code is wrong, please supply me with a sample code to add data in datagrid...using vb.net and MS Access

2006-08-03 03:09:11 · update #1

2 answers

You're either not clearing out the tablemappings before trying to add the same one back in, or you aer not using the correct parameters...it 's hard to tell because you truncated that line...

2006-08-03 08:15:03 · answer #1 · answered by Just David 5 · 0 0

The exception you are receiving is the result of your having supplied an invalid/improper argument to a method. Double-check the specifications for the methods you are invoking to ensure you are sending the appropriate datatype arguments.

2006-08-03 10:38:54 · answer #2 · answered by Arkangyle 4 · 0 0

fedest.com, questions and answers