RDA synchronization test, which has passed the test on the computer

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.