strSQL = "SELECT DISTINCT IDPro FROM Re_StgbtyOld"
dtAdapter = New SqlDataAdapter(strSQL, objConn)
dtAdapter.Fill(ds1)
dt1 = ds1.Tables(0)
If dt1.Rows.Count >= 0 Then
For iii = 0 To dt1.Rows.Count - 1
a = 0
b = 0
d = 0
For ii = 1 To g 'g
strSQL = "SELECT * FROM TG_" & ii & ""
dtAdapter = New SqlDataAdapter(strSQL, objConn1)
dtAdapter.Fill(ds)
dt = ds.Tables(0)
a = a + dt.Rows(iii)("Bangkok1_P")
b = b + dt.Rows(iii)("Center1_P")
d = d + dt.Rows(iii)("East1_P")
Next
strqr = "UPDATE Re_StgbtyOld SET [Bangkok1_P] = '" & a & "' " & _
",[Center1_P] = '" & b & "' " & _
",[East1_P] = '" & d & "' " & _
" WHERE IDPro like '" & dt.Rows(iii)("IDPro") & "' "
objCmd = New SqlCommand(strqr, objConn)
objCmd.ExecuteNonQuery()