i have a scenario where i need to split columns from a single Table (Customer) into 2 SQL Statements and in result I have two Datasets. I merge the 2nd dataset with the First one. I insert values in all the columns and bind to a GRID (FOR testing purpose) . I can see that it works fine with all the columns and values in the Grid.
But When I try to update the Dataset I can see the All the values in the columns Name,place in customer table but not the values from columns in Second SQL Statement. I can see in Grid everything works fine but in Database i cant see .. Belo wis the code. If this works I would be v happy as I struggling to achieve this.
strcheck = "select customer_id,name,place from customers where customer_id= 100
strcheck1 = "select customer_id,DOB,address,ph
one,zip from customers where customer_id =100
cmdd = New OleDbCommand
cmdd.CommandText = strcheck
cmdd.Connection = FoxproConnection
Dim d As New OleDbDataAdapter(strcheck,
Connstrfox)
d = New OleDbDataAdapter(cmdd)
d.SelectCommand = New OleDbCommand(strcheck, Connstrfox)
Dim CB As OleDbCommandBuilder = New OleDbCommandBuilder(d)
d.Fill(ds1,"Customers")
Dim cmdd1 As New OleDbCommand
cmdd1.CommandText = strcheck1
cmdd1.Connection = FoxproConnection
Dim d1 As New OleDbDataAdapter(cmdd1)
d1.SelectCommand = New OleDbCommand(strcheck1, Connstrfox)
Dim CB1 As OleDbCommandBuilder = New OleDbCommandBuilder(d1)
d1.Fill(ds2, "Customers")
'MERGE DATASET
ds1.merge(ds2) // Msgbox(Ds1.tables(0).colum
ns.count.t
ostring) Returns 7 columns after Merge (Works good)
ds1.accepts changes
Dim drCurrent As DataRow
Dim tbl As DataTable
tbl = ds1.Tables("customers")
if ds1.tables(0).row(0).item(
"Customer_
ID") = ds2.tables(0).row(0).item(
"Customer_
id") then
drCurrent = ds1.Tables("customer").New
Row
drcurrent("name") = "john"
drCurrent("Place") = "CA"
drCurrent("Address") = ds2.tables(0).row(0).item(
"Address")
drCurrent("phone") =ds2.tables(0).row(0).item
("phone")
drcurrent("ZIP") = ds2.tables(0).row(0).item(
"ZIP")
End if
d.Update(ds1)