Results 1 to 8 of 8

Thread: How do I....

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2004
    Posts
    28

    How do I....

    How do I display the data I retrive from a microsoft access database into a textbox in VB.NET?

  2. #2
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    something like this
    VB Code:
    1. Dim cn As New OleDbConnection()
    2.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    3.         cn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=d:/northwind.mdb"
    4.         cn.Open()
    5.         Dim cm As New OleDbCommand("select companyname from customers where customerid='alfki'", cn)
    6.         TextBox1.Text = CType(cm.ExecuteScalar, String)
    7.         cn.Close()
    8.     End Sub

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2004
    Posts
    28
    Thanks a lot. I tried seatching on the net but a lot of example are meant for web based development, not desktop application

  4. #4
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Originally posted by Buaya_hunter
    Thanks a lot. I tried seatching on the net but a lot of example are meant for web based development, not desktop application
    Did it work?
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Aug 2004
    Posts
    28
    It works very well for my purpose

  6. #6
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    The reason why I asked was that I had to use

    Dim cn As New Oledb.OleDbConnection()

    Dim cm As New Oledb.OledbCommand
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  7. #7
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    imports system.data.oledb

  8. #8
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Originally posted by brown monkey
    imports system.data.oledb
    Thank you
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width