Originariamente inviato da tossam
E' lo stesso metodo del quale parlavamo per e-mail!
Max mercury... puoi postare un esempio di come si può fare l'aggiunta di un record e utilizzare poi l'Update? Grazie
Devi usare il metodo NewRow del DataTable, ti posto l'esempio che trovi anche
su MSN:
codice:
Dim table As DataTable = dataSet.Tables("Suppliers")
' Use the NewRow method to create a DataRow
'with the table's schema.
Dim newRow As DataRow = table.NewRow()
' Set values in the columns:
newRow("CompanyID") = "NewCompanyID"
newRow("CompanyName") = "NewCompanyName"
' Add the row to the rows collection.
table.Rows.Add(newRow)
c#
codice:
DataTable table;
table = dataSet.Tables["Suppliers"];
// Use the NewRow method to create a DataRow with
// the table's schema.
DataRow newRow = table.NewRow();
// Set values in the columns:
newRow["CompanyID"] = "NewCompanyID";
newRow["CompanyName"] = "NewCompanyName";
// Add the row to the rows collection.
table.Rows.Add(newRow);
ovvio che tutto questo non basta devi usare un dataAdapter per riempirti il dataset
e poi chiamare il metodo update sul dataAdapter
trovi un esempio al link
http://msdn.microsoft.com/it-it/libr...8VS.80%29.aspx