RDA同步測試, 已經在本電腦上測試通過

來源:互聯網
上載者: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 Button1_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
        '修改本機資料
        Try
            '定義串連
            Dim conn As New SqlCeConnection
            conn.ConnectionString = Me.s_localstr
            conn.Open()
            '定義命令
            Dim cmd As New SqlCeCommand
            cmd.Connection = conn
            cmd.CommandText = "update employee set dspname=@a where employeeid=@b"
            '定義參數
            Dim p1 As New SqlCeParameter
            p1.ParameterName = "@a"
            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("成功:修改成功!", "提示", 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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.