Results 1 to 2 of 2

Thread: vb.net and access

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2003
    Posts
    2

    vb.net and access

    hi im new to vb.net

    trying to enter data in a datagrid with access

    created oledbdataconnection and dataset

    set datagrid member and source to dataset

    using jet 4.0

    it reads the headers from the db but not the fields.

    tried hardcoding the connection, but not worked.

    does anyone know where i am going wrong, or any tips

    can provide more info if needed

    thanks
    adam

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I don't know about your code but you can adapt this code to meet your needs .

    VB Code:
    1. 'setup the connection
    2.         Dim MyConnection As New OleDbConnection(CnnStr)
    3.         'setup the adapter
    4.         Dim da As New OleDbDataAdapter("SELECT * FROM MyTab", MyConnection)
    5.         'make a dataset to read into
    6.         Dim ds As New DataSet()
    7.         'open the connection
    8.         MyConnection.Open()
    9.         'now do the reading
    10.         da.Fill(ds, "MyTab")
    11.         'close and clean up
    12.         MyConnection.Close()
    13.         MyConnection.Dispose()
    14.         da.Dispose()
    15.         'bind to grid
    16.         dgBinding.DataSource = ds.Tables("MyTab")

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