I first save all HoleNo into B from A sqlSTR = "SELECT * FROM A" ExecuteSQLQuery(sqlSTR) 'call function to execute the query For Each row1 As DataRow In sqlDT.Rows sqlSTR = "INSERT INTO B (HoleNo) VALUES ('" & row1(0) & "')" ExecuteSQLQuerylocal(sqlSTR) 'call function to execute the query Next So after inserting all HoleNo then I try to update the rest of the fields with this code sqlSTR = "SELECT * FROM A" ExecuteSQLQuery(sqlSTR) 'call function to execute the query For Each row1 As DataRow In sqlDT.Rows sqlSTR = "UPDATE B SET Depth_from ='" & row(0) & "' WHERE HoleNo ='" & row(0) & "'" ExecuteSQLQuerylocal(sqlSTR) Next
DROP TABLE B GO SELECT * INTO B From A GO
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)