Re: working with dataset

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



hi, here is the code to insert a row and update ur table. I don't know code
to join 2 tables. Its in VB.net but am sure u will get some idea.

Dim myConnection As SqlConnection

Dim mySqlDataAdapter As SqlDataAdapter

myConnection = New SqlConnection("")

mySqlDataAdapter = New SqlDataAdapter("Select * from tblInstallation",
myConnection)

Dim myDataSet As DataSet = New DataSet

Dim myDataRow As DataRow

' Create command builder. This line automatically generates the update
commands for you, so you don't

' have to provide or create your own.

Dim myDataRowsCommandBuilder As SqlCommandBuilder = New
SqlCommandBuilder(mySqlDataAdapter)

' Set the MissingSchemaAction property to AddWithKey because Fill will not
cause primary

' key & unique key information to be retrieved unless AddWithKey is
specified.

mySqlDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey

mySqlDataAdapter.Fill(myDataSet, "tblInstallation")

myDataRow = myDataSet.Tables("tblInstallation").NewRow()

myDataRow("StoreCode") = "storeno"

myDataRow("Installer") = Me.tx_installer.Text

myDataRow("dt_stamp1") = Me.lbl_date.Text

myDataRow("Assessor") = Me.tx_assessor.Text

myDataSet.Tables("tblInstallation").Rows.Add(myDataRow)

mySqlDataAdapter.Update(myDataSet, "tblInstallation")

myDataSet = Nothing


"kalaivanan" <mail2kalai@xxxxxxxxx> wrote in message
news:1154326181.769698.138460@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
how do i insert new row, update and join two tables in a dataset.



.