Dim queryMainID As String = "IF NOT EXISTS (SELECT * FROM table2 WHERE mainID = '" & MainID & "') INSERT INTO table2 (field3, mainid) VALUES ('TEST', '5') SELECT SCOPE_IDENTITY() as mainID"
Dim dscmd As New SqlDataAdapter(UpdateSTS, DB)
Dim ds As New DataSet()
dscmd.Fill(ds, "MainIDQuery")
Dim dt As DataTable = ds.Tables.Item("MainIDQuery")
Dim rowJob As DataRow
For Each rowJob In dt.Rows
Dim field3 = rowJob.Item("field3").ToString
Next
|