Here is my problem in SQL query, result has been successful to load data in datagrid like SL_No (2,4,5) but some data are missing from table Pairing
like (1,2,3,4,5,6) where relationship table data is not available like (1,3,6) in Receipt
table.
Private Sub BtnView_Click(sender As Object, e As EventArgs) Handles btnView.Click
Dim Sql as String = "Select Pairing.Ledger_Index, Pairing.Fr_Customer_no, Pairing.Fr_Customer_nm, Receipt.Dt_Entry, Receipt.Price from Pairing INNER JOIN Receipt ON Pairing.Fr_Customer_no = Receipt.Sub_No WHERE (((Pairing.Ledger_Address)='" & cmbList.Text & "'))""
If RdoLedger.Checked=True Then
DatagridView_Load("sql",DatagridView1)
End If
End Sub
Public Function DatagridView_Load(ByVal Sql As String, ByVal Model As DataGridView)
Try
If con.State = ConnectionState.Open Then
con.Close()
End If
Model.DataSource = Nothing
Dim da As New OleDbDataAdapter(Sql, con)
Dim dt As New DataTable
dt.Clear()
da.Fill(dt)
If IsDBNull(dt) = False Then
Model.DataSource = (dt)
con.Close()
Else
Model.DataSource = Nothing
con.Close()
End If
Catch ex As Exception
MsgBox("ERROR : " & ex.Message.ToString)
End Try
Return True
End Function
Thank You No Body reply Me, Because I will not understand this questions answer. This is some simple answer. here i was wanted all record of 1st table. so my query was should be = from Pairing INNER JOIN Receipt changed to from Pairing left JOIN Receipt its get my result successfully
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.