01.
02.
02.
Dim
conn
As
New
SqlConnection(
"packet size=4096;user id=(username);data source=(server name or IP); persist security info=True;initial catalog=(database name);password=*****"
)
03.
03.
04.
04.
05.
05.
Dim
cmd
As
New
SqlCommand(
"SELECT * FROM tablex"
, conn)
06.
06.
07.
07.
08.
08.
09.
09.
Dim
da
As
New
SqlDataAdapter(cmd)
10.
10.
11.
11.
12.
12.
Dim
ds
As
New
DataSet()
13.
13.
14.
14.
15.
15.
If
conn.State = ConnectionState.Closed
Then
16.
16.conn.Open()
17.
17.
End
If
18.
18.
19.
19.
20.
20.da.Fill(ds,
"Tablename"
)
21.
21.
22.
22.
23.
23.
24.
24.cmd =
New
SqlCommand(
"INSERT INTO tablex VALUES (@param1, @param2, @param3)"
)
25.
25.cmd.Parameters.Add(
New
SqlParameter(
"@param1"
, SqlDbType.NVarChar, 35,
"Param1"
))
26.
26.cmd.Parameters.Add(
New
SqlParameter(
"@param2"
, SqlDbType.NVarChar, 35,
"Param1"
))
27.
27.cmd.Parameters.Add(
New
SqlParameter(
"@param3"
, SqlDbType.NVarChar, 35,
"Param1"
))
28.
28.
29.
29.
30.
30.
If
conn.State = ConnectionState.Closed
Then
31.
31.conn.Open()
32.
32.
End
If
33.
33.
34.
34.
35.
35.
Dim
rowaffects = cmd.ExecuteNonQuery()