Results 1 to 5 of 5

Thread: Datagrid (RESOLVED)

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Posts
    153

    Datagrid (RESOLVED)

    My button_click event does not show datagrid when execute command. Instead I have to click on plus sign, then the word table to see the results in grid format. How can I modifiy code to
    show grid format went command is executed?

    The code below is driven by the combobox selection. However, I'm able to get it to execute properly on first try. Subsequent click event result in error "cannot creat child list for Apr04". Any ideas what's wrong with the code?

    thanks


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim DS As System.Data.DataSet
    Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
    Dim MyConnection As System.Data.OleDb.OleDbConnection

    MyConnection = New System.Data.OleDb.OleDbConnection( _
    "provider=Microsoft.Jet.OLEDB.4.0; " & _
    "data source=C:\Inetpub\wwwroot\intelis.MDB")

    MyCommand = New System.Data.OleDb.OleDbDataAdapter( _
    "select * from APR04 where Entity = '" & ComboBox1.Text.Trim & "'", MyConnection)

    DS = New System.Data.DataSet
    DS.Clear()

    MyCommand.Fill(DS)

    DataGrid1.DataMember = "APR04"
    DataGrid1.DataSource = DS
    'MyConnection.Close()
    End Sub
    Last edited by Hutty; Jun 23rd, 2004 at 02:41 PM.

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