diverdan
Active member
Hi there
I am sure this is really easy but I have a form that contains a number of textboxes and also a datagrid.
I have a textbox on the form called txtCustomerID which displays the primary key for tblCustomers and also I have another table called tblQuotes which has CustomerID as a FK.
What I would like is for the datagrid to be showing all quotes that relate to the customer.
This is my code.
Can anyone show me what I need to do to enable what im trying to do.
Thank you!!!
I am sure this is really easy but I have a form that contains a number of textboxes and also a datagrid.
I have a textbox on the form called txtCustomerID which displays the primary key for tblCustomers and also I have another table called tblQuotes which has CustomerID as a FK.
What I would like is for the datagrid to be showing all quotes that relate to the customer.
This is my code.
Can anyone show me what I need to do to enable what im trying to do.
VB.NET:
Me.WindowState = FormWindowState.Maximized
Dim conn As New SqlClient.SqlConnection("Server = " & "nx6130" & _
"; Database = ActionGlass; " & _
"Integrated Security = sspi;")
Dim ds As New DataSet
Dim daQuotes As New SqlClient.SqlDataAdapter("SELECT tblQuotes.QuoteID,DateOfQuote,CustomerID FROM tblQuotes WHERE tblQuotes.CustomerID = '10' ", conn)
Dim daPayments As New SqlClient.SqlDataAdapter("SELECT tblPayments.PaymentID FROM tblPayments", conn)
Dim daOrders As New SqlClient.SqlDataAdapter("SELECT * from tblOrders", conn)
daOrders.Fill(ds, "tblOrders")
daQuotes.Fill(ds, "tblQuotes")
daPayments.Fill(ds, "tblPayments")
grdInvoices.ReadOnly = True
grdQuotes.ReadOnly = True
grdPayments.ReadOnly = True
grdInvoices.AllowUserToAddRows = False
grdInvoices.DataSource = ds
grdQuotes.DataSource = ds
grdPayments.DataSource = ds
grdInvoices.DataMember = "tblOrders"
grdQuotes.DataMember = "tblQuotes"
grdPayments.DataMember = "tblPayments"
End Sub