my database query is running but i am facing error "object reference is not set to an instance of abject"
Try
If Not con.State = ConnectionState.Open Then
con.Open()
End If
Dim da As New OleDb.OleDbDataAdapter(" SELECT TICKET.TICKET_NO,TICKET.CUSTOMER_ID,FLIGHT.FLIGHT_ID,FLIGHT.FLIGHT_CHARGES FROM TICKET_RESERVATION AS TICKET INNER JOIN FLIGHT_DETAILS AS FLIGHT ON TICKET.FLIGHT_ID = FLIGHT.FLIGHT_ID WHERE [TICKET.TICKET_NO]= '" & txtTicketNo.Text & "'", con)
Dim ds As New DataSet
da.Fill(ds)
If ds.Tables("TICKET_RESERVATION", "FLIGHT_DETAILS").Rows.Count > 0 Then
txtTicketNo.Text = ds.Tables("TICKET_RESERVATION").Rows(0).Item(0).ToString()
txtCustomerId.Text = ds.Tables("TICKET_RESERVATION").Rows(0).Item(1).ToString()
txtFlightId.Text = ds.Tables("TICKET_RESERVATION").Rows(0).Item(2).ToString()
txtAmount.Text = ds.Tables("FLIGHT_DETAILS").Rows(0).Item(3).ToString()
End If
con.Close()
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
I Think error is here but i dnt know how to resolve it
da.Fill(ds)
If ds.Tables("TICKET_RESERVATION", "FLIGHT_DETAILS").Rows.Count > 0 Then
txtTicketNo.Text = ds.Tables("TICKET_RESERVATION").Rows(0).Item(0).ToString()
txtCustomerId.Text = ds.Tables("TICKET_RESERVATION").Rows(0).Item(1).ToString()
txtFlightId.Text = ds.Tables("TICKET_RESERVATION").Rows(0).Item(2).ToString()
txtAmount.Text = ds.Tables("FLIGHT_DETAILS").Rows(0).Item(3).ToString()
End If
error here in this line
If ds.Tables("TICKET_RESERVATION", "FLIGHT_DETAILS").Rows.Count > 0 Then