Imports system. Data
Imports system. Data. sqlclient
Imports system. Data. sqlserverce
Imports system. xml
Public class form1
Dim s_remotestr as string
Dim s_localstr as string
Private sub form1_load (byval sender as system. Object, byval e as system. eventargs) handles mybase. Load
S_remotestr = "provider = sqloledb; Data Source = 172.18.188.19; initial catalog = infodb; persist Security info = true; user id = sa; Password = sa"
S_localstr = "Data Source = \ now. SDF; Password = sa"
End sub
Private sub button#click (byval sender as system. Object, byval e as system. eventargs) handles button1.click
'Pull
Try
Dim RDA as sqlceremotedataaccess
RDA = new sqlceremotedataaccess ()
RDA. localconnectionstring = s_localstr
RDA. interneturl = "http: // 172.18.188.19/web3/sqlcesa30.dll"
RDA. Pull ("t1_temp", "select ID, dspname from T1", s_remotestr, rdatrackoption. trackingon, "error ")
MessageBox. Show ("success ")
Catch ex as exception
MessageBox. Show (ex. tostring ())
End try
End sub
Private sub button2_click (byval sender as system. Object, byval e as system. eventargs) handles button2.click
'Modify local data
Try
'Define the connection
Dim conn as new sqlceconnection
Conn. connectionstring = me. s_localstr
Conn. open ()
'Define the command
Dim cmd as new sqlcecommand
Cmd. Connection = Conn
Cmd. commandtext = "Update employee set dspname = @ A where employeeid = @ B"
'Define parameters
Dim P1 as new sqlceparameter
P1.parametername = "@"
P1.sqldbtype = sqldbtype. nvarchar
P1.size = 20
P1.value = textbox2.text
Dim P2 as new sqlceparameter
P2.parametername = "@ B"
P2.sqldbtype = sqldbtype. int
P2.value = textbox1.text
Cmd. Parameters. Add (P1)
Cmd. Parameters. Add (P2)
Cmd. executenonquery ()
Conn. Close ()
MessageBox. Show ("successful: Modification successful! "," Prompt ", messageboxbuttons. OK, messageboxicon. Asterisk, messageboxdefaultbutton. button1)
Catch ex as exception
MessageBox. Show (ex. tostring ())
End try
End sub
Private sub button3_click (byval sender as system. Object, byval e as system. eventargs) handles button3.click
'Push
Dim RDA as new sqlceremotedataaccess
Try
RDA. localconnectionstring = s_localstr
RDA. interneturl = "http: // 172.18.188.19/web3/sqlcesa30.dll"
RDA. Push ("employee", s_remotestr)
MessageBox. Show ("success ")
Catch ex as exception
MessageBox. Show (ex. tostring ())
Finally
RDA. Dispose ()
End try
End sub
End Class