Hello Larry,
Thanks you very much for your reply. This fills the dataset, I need to merge
it with another dataset with the same schema, will that work with three
tables?
"Larry Charlton" wrote:
> The easy way is with the dataset designer. If you want to do it
> programmatically, try:
>
> Dim connString As String = My.Settings.ProjectConnection
> Dim ds As New DataSet
>
> Using cnn As New SqlClient.SqlConnection(connString)
> cnn.Open()
> Using cmd As New SqlClient.SqlCommand("mySP", cnn)
> cmd.CommandType = CommandType.StoredProcedure
> cmd.Parameters.AddWithValue("@myParam", myValue)
> Using da As New SqlClient.SqlDataAdapter(cmd)
> da.TableMappings.Add("Table", "MyDatasetName1")
> da.TableMappings.Add("Table1", "MyDatasetName2")
> da.TableMappings.Add("Table2", "MyDatasetName3")
> da.Fill(ds)
> End Using
> End Using
> cnn.Close()
> End Using
>
> In the stored procedure just write some SQL
> SELECT * FROM MyTableName1
> SELECT * FROM MyTableName2
> SELECT * FROM MyTableName3
>
> It will work equally well with multiple dynamic SQL statements.
>
>
|