Net操作Webservices 的例子(3)

Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlServerCe
Imports System.IO
Imports System.Xml

Public Class Form3
    Public mm As Integer

   //参数传递并显示 
   Public Sub ref(ByVal p1 As String, ByVal p2 As String, ByVal p3 As String, ByVal p4 As String, ByVal row As Integer)
        Me.Label6.Text = p1
        Me.Label7.Text = p2
        Me.Label8.Text = p3
        Me.TextBox1.Text = p4
        mm = row
    End Sub

    Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        mm = Form2.row.ToString
    End Sub

    //保存本机, 并刷新前一页的DataGrid的显示
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Dim g As Integer
        Dim con As SqlCeConnection
        con = New SqlCeConnection("DataSource=\mysdf.sdf")
        Dim com As SqlCeCommand
        'com = New SqlCeCommand("insert into PC values ('" + pc(i).PCNO.ToString + "','" + pc(i).XH.ToString + " ','" + pc(i).WERKS.ToString + "','" + pc(i).PC_DATE.ToString + "')")
        con.Open()
        com = New SqlCeCommand("Update PC Set  PC_DATE='" + Me.TextBox1.Text + "' where PCNO='" + Me.Label6.Text + "'")
        com.Connection = con
        com.ExecuteNonQuery()
        con.Close()
        MessageBox.Show("success")

        Dim com1 As SqlCeCommand
        com1 = New SqlCeCommand("select * from PC")
        Dim adapter As SqlCeDataAdapter
        adapter = New SqlCeDataAdapter()
        adapter.SelectCommand = com1

        Dim data As DataTable
        data = New DataTable

        con.Open()
        com1.Connection = con
        adapter.Fill(data)
        Form2.SetData(data, mm)
        Form2.ShowDialog()

    End Sub
End Class

posted @ 2007-06-15 08:42  寒天飞雪  阅读(297)  评论(0编辑  收藏  举报