Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Da As New SDS.OleDbDataAdapter("Select * from Trip WHERE AgentID = '" & ComboBox1.Text & "' and Country = '" & ComboBox2.Text & "' and Category = '" & ComboBox3.Text & "' and SCategory = '" & ComboBox4.Text & "' and TDate = #" & ComboBox5.Text & "# ; ", connection)
        Dim Ds As New DataSet
        Ds.Clear()
        Try
            Da.Fill(Datas, "Trip")
            DG1.DataSource = Ds
            DG1.DataMember = "Trip"
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub


My Error is : This Code is Passes Null in Datagrid, but if I fire the same query in access 2003, it gives me Result without Error.

If I fire the same query with Static Data like where AgentID ='admin' and Country='India' etc. also Vb.Net Fills DataGrid.

This Query also work till combination of four dynamic "DropDown.Text" but whenevervI tried for five "DropDown.Text" it's Passed Null in DataGrid.
Posted
Updated 22-May-11 0:02am
v4
Comments
Dalek Dave 22-May-11 6:09am    
Edited for Grammar and Readability.

1 solution

Instead of:
DG1.DataSource = Ds


try:
DG1.DataSource = Ds.Tables(0)
 
Share this answer
 
v2
Comments
s1a2b3 23-May-11 3:24am    
Thanks . . . . .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900