i am new in vb .net i am making a project airline reservation system so i have to fetch data from two tables and show in my vb form textboxs i am using inner join to fetching data from two different table but i am always getting error pls guys see my code and suggest me.here TICKET_NO,CUSTOMER_ID and FLIGHT_ID here in TICKET_RESERVATION Table and FLIGHT_CHARGES here in in FLIGHT_DETAILS Table and FLIGHT_ID column here in both TICKET_RESERVATION and FLIGHT_DETAILS Tables pls help me
I am getting error no value given for one or more required parameter
Try
If Not con.State = ConnectionState.Open Then
con.Open()
End If
Dim da As New OleDb.OleDbDataAdapter("SELECT TICKET.TICKET_NO,CUSTOMER.CUSTOMER_ID,FLIGHT.FLIGHT_ID,FLIGHT.FLIGHT_CHARGES FROM TICKET_RESERVATION INNER JOIN FLIGHT_DETAILS ON TICKET_RESERVATION.FLIGHT_ID = FLIGHT_DETAILS.FLIGHT_ID WHERE [TICKET_NO]= '" & txtTicketNo.Text & "'", con)
Dim ds As New DataSet
da.Fill(ds, "TICKET_RESERVATION")
If ds.Tables("TICKET_RESERVATION").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
now my prblem is solve but Now i am getting error Object reference not set to an instance of object i think now prblem in my this code
Dim ds As New DataSet
da.Fill(ds)
If ds.Tables("TICKET_RESERVATION").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