posts - 9,  comments - 0,  trackbacks - 0

Imports System.Data.OleDb

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        DSLIST11.Clear()

        OleDbDataAdapter1.Fill(DSLIST11, "通信录1")


    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.BindingContext(DSLIST11, "通信录1").Position -= 1
        showp()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Me.BindingContext(DSLIST11, "通信录1").Position += 1
        showp()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim myconn As String = "Provider=Microsoft.Jet.OLEDB.4.0;data source=d:\mydoc\Visual Studio 2005\Projects\PRJ_dbCONN\PRJ_dbCONN\test1.mdb;"

        OleDbConnection1 = New OleDb.OleDbConnection(myconn) 

        OleDbDataAdapter1 = New OleDbDataAdapter("select 分类1,id from 通信录1", OleDbConnection1) '2

        OleDbDataAdapter1.Fill(DSLIST11, "通信录1") '3

        DataGridView1.DataSource = DSLIST11.Tables(0) '4

 


       

 

        'TextBox2.Text = Me.Name

 

 


    End Sub
    Private Sub showp()
        Dim iCnt As Integer
        Dim iPos As Integer
        iCnt = Me.BindingContext(DSLIST11, "通信录1").Count
        If iCnt = 0 Then
            TextBox2.Text = "(No records)"
        Else
            iPos = Me.BindingContext(DSLIST11, "通信录1").Position + 1
            TextBox2.Text = iPos.ToString & " of " & iCnt.ToString
        End If

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        OleDbDataAdapter1.SelectCommand = New OleDb.OleDbCommand("select top 5 * from 通信录1", OleDbConnection1)
        DSLIST11.Clear()
        OleDbDataAdapter1.Fill(DSLIST11, "通信录1")
    End Sub

    Private Sub OleDbConnection1_InfoMessage(ByVal sender As System.Object, ByVal e As System.Data.OleDb.OleDbInfoMessageEventArgs) Handles OleDbConnection1.InfoMessage

    End Sub
End Class

posted on 2006-11-12 21:16 MT'S BLOG 阅读(216) 评论(0)  编辑 收藏 引用
只有注册用户登录后才能发表评论。

<2024年12月>
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

常用链接

留言簿(1)

随笔分类

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜