Results 1 to 8 of 8

Thread: Jet and .NET

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Hendersonville , NC
    Posts
    260

    Question Jet and .NET

    I have this code:

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Dim cmd As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\Export.mdb;"
    Dim dc As New OleDb.OleDbConnection(cmd)
    Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM MdseFile", cmd)
    Dim ds As New DataSet()
    dc.Open()
    da.Fill(ds, "MdseFile")
    dc.Close()
    dc.Dispose()
    da.Dispose()
    'bind to grid
    DataGrid1.DataSource = ds.Tables("ItemMast")
    End Sub

    and have a datagrid on my form.
    This runs (at least no running error) but does not fill out the datagrid and display any data. There is data in the file MDSEFILE.

    What am I doing wrong?
    William E Gollnick

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    There is data in the file MDSEFILE.

    Is this file or table in the database??
    I hope it's typing mistake

  3. #3
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    You never call the DataBind method of the grid.

    After this line:
    DataGrid1.DataSource = ds.Tables("ItemMast")

    insert:
    DataGrid1.DataBind()

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I can bind it without that line though !

  5. #5
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474

    You never call the DataBind method of the grid.

    After this line:
    DataGrid1.DataSource = ds.Tables("ItemMast")

    insert:
    DataGrid1.DataBind()
    There is not such a method as DataBind for datagird. At least I am not aware of.

    The problem is he is setting the datasource as DataGrid1.DataSource = ds.Tables("ItemMast")

    but "ItemMast" is not a table in ds.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    exactly , it confused me . It might be another table in the same database .

  7. #7
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Sorry, I was thinking of the Web Data Grid.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Hendersonville , NC
    Posts
    260

    Resolved and thanks

    Issue resolved .. the line DataGrid1.Databind() was not valid and did not work. It was a matter of dumb typing...
    William E Gollnick

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