Thanks Cor ))
this is what i ended up doing (with some code snippets lifted from
5. enders Oct 11 2002, 9:30 am post on this newsgroup:
=====================================
Private Sub SaveChanges_DA(ByVal ads As DataSet)
'saves are at table-level scope
'need to find correct dataAdapter for passed dataset
'this info is not available in this version of vb.net dataset object
'assumptions: 1) ds has one table and da has one table
Dim propInfos() As System.Reflection.PropertyInfo
Dim propInfo As System.Reflection.PropertyInfo
propInfos = Me.GetType.GetProperties()
For Each propInfo In propInfos
If propInfo.PropertyType.FullName =
"System.Data.SqlClient.SqlDataAdapter" Then
Dim da As System.Data.SqlClient.SqlDataAdapter
da = CType(propInfo.GetValue(Me, Nothing),
System.Data.SqlClient.SqlDataAdapter)
If da.TableMappings(0).DataSetTable.ToString.ToLower =
ads.Tables(0).TableName.ToString.ToLower Then
'have match - this da is the source for the passed
dataset
Try
da.Update(ads)
Me.DS1.AcceptChanges()
Catch exc As Exception
MsgBox(exc.Message)
End Try
End If
End If
Next
=====================================
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:Ot****************@TK2MSFTNGP12.phx.gbl...
Astro,
.....but I wonder if this information is not stored in the DataSet
itself......
It will be in the next version of VBNet.
However see by instance this sample how to make your dataadapter by code,
than you don't have it on your screen.
However you need the updatecommand, insertcommand, deletecommand
properties from the dataadapter. For that are two approaches, you use
first the designer and copies them from the designer part, or you use the
commandbuilder (which goes fine by simple selects).
See some threads I wrote about above.
http://www.windowsformsdatagridhelp....7-5595f8147624
http://msdn.microsoft.com/library/de...mberstopic.asp
http://msdn.microsoft.com/library/de...classtopic.asp
It has not really much sense if you use one dataadapter.
I don't like all those dataadapters in my form as well. I find it too a
nice approach to create a component (selecting an item component) and use
that to make a databaseclass (databaselayer).
I hope this helps,
Cor
Cor