T
Tina
Below is pasted how I normally do an insert using a design time data adapter
and dataset in an
ASP.NET application. How can I least modify this code to do an update? (I
have all of the commands
generated in the data adapter)
Thanks,
T
Dim insertRow As dsPartNumsNew.PartNumbersRow
insertRow = DsPartNumsNew1.PartNumbers.NewRow()
insertRow.PP_Part_Num = tbPartNo.Text
insertRow.Description = tbDescription.Text
insertRow.Category = tbCategory.Text
insertRow.Manufacturer = tbManufacturer.Text
If tbPrice.Text.Trim = "" Then
insertRow._Price_ = 0
Else
insertRow._Price_ = tbPrice.Text
End If
insertRow.GL_Code = ddlGL.SelectedValue
insertRow.DeletedByUser = False
insertRow.TrackInventory = cbTrackInv.Checked
'add the row to the dataset...
Try
DsPartNumsNew1.PartNumbers.AddPartNumbersRow(insertRow)
daPartNumsNew.Update(DsPartNumsNew1)
Catch ex As SqlException
If ex.Number = 2627 Then
lblError.Text = "Part already exists"
Exit Sub
Else
lblError.Text = ex.Message
Exit Sub
End If
End Try
and dataset in an
ASP.NET application. How can I least modify this code to do an update? (I
have all of the commands
generated in the data adapter)
Thanks,
T
Dim insertRow As dsPartNumsNew.PartNumbersRow
insertRow = DsPartNumsNew1.PartNumbers.NewRow()
insertRow.PP_Part_Num = tbPartNo.Text
insertRow.Description = tbDescription.Text
insertRow.Category = tbCategory.Text
insertRow.Manufacturer = tbManufacturer.Text
If tbPrice.Text.Trim = "" Then
insertRow._Price_ = 0
Else
insertRow._Price_ = tbPrice.Text
End If
insertRow.GL_Code = ddlGL.SelectedValue
insertRow.DeletedByUser = False
insertRow.TrackInventory = cbTrackInv.Checked
'add the row to the dataset...
Try
DsPartNumsNew1.PartNumbers.AddPartNumbersRow(insertRow)
daPartNumsNew.Update(DsPartNumsNew1)
Catch ex As SqlException
If ex.Number = 2627 Then
lblError.Text = "Part already exists"
Exit Sub
Else
lblError.Text = ex.Message
Exit Sub
End If
End Try