01.
Dim
conn
As
New
SqlConnection("Server1)
02.
Dim
sql
As
String
03.
Dim
i
As
Integer
= 0
04.
Dim
dssale
As
New
DataTable
05.
Dim
cmd
As
SqlCommand
06.
07.
Try
08.
If
(conn.State = ConnectionState.Closed)
Then
09.
conn.Open()
10.
End
If
11.
12.
sql =
"Select SALESID,EXPORTINVOICEID,BUNDLENO,NAME,SALESQUOTEDQTY,NETWEIGHT from TGP_DEV_MillTestCer where EXPORTINVOICEID Like '%"
& txtinno.Text &
"%'"
13.
14.
cmd =
New
SqlCommand(sql, conn)
15.
16.
Dim
dataAdapter
As
SqlDataAdapter =
New
SqlDataAdapter(cmd)
17.
dataAdapter.Fill(dssale)
18.
19.
20.
Try
21.
Dim
conn2
As
New
SqlConnection("Serve2)
22.
23.
If
(conn2.State = ConnectionState.Closed)
Then
24.
conn2.Open()
25.
End
If
26.
27.
For
i = 0
To
dssale.Rows.Count
28.
29.
30.
If
i < dssale.Rows.Count - 1
Then
31.
32.
33.
cmd.CommandText = "insert into tblmilltestcertificate (inno_deliver, snno_deliver, packagenum, spac_od, numberpcs, numberkg)
34.
VALUES(
35.
cmd.CommandType = CommandType.Text
36.
cmd.Connection = conn2
37.
cmd.ExecuteNonQuery()
38.
39.
i = i + 1
40.
41.
End
If
42.
Next
43.
44.
Catch
ex
As
Exception
45.
46.
End
Try
47.
48.
Catch
ex
As
Exception
49.
MsgBox(ex.ToString)
50.
GetHeadline =
Nothing