manared
Well-known member
- Joined
- Jun 1, 2006
- Messages
- 84
- Programming Experience
- 1-3
I have a program that had an Access backend, but I'm in the process of converting everything to SQL. I think I'm having problems with my sql statements and then trying to read from them. I have multiple tables, but when I read it, I can't list the table and field in it. How else can I do this? My code as of now is shown below.
lblCompany.text finds an entry and does not error out, but the first statement does: QuoteMaster.ID. Does anyone have any ideas? Do I have to read each table seperately or create a datatable or something?
VB.NET:
Dim MySQL As String = "SELECT QuoteMaster.*, QuoteCheckList.*, QuoteForecast.*, Salesperson.*, Customer.*, LookupQuoteIncludeType.*, LookupQuoteStatus.*, LookupSalesRep.* FROM (((((QuoteCheckList INNER JOIN (QuoteMaster INNER JOIN QuoteForecast ON QuoteMaster.ID = QuoteForecast.ID) ON (QuoteCheckList.ID = QuoteMaster.ID) AND (QuoteCheckList.ID = QuoteForecast.ID)) INNER JOIN Salesperson ON QuoteMaster.SalesPersonID = Salesperson.ID) INNER JOIN Customer ON QuoteMaster.BuyerID = Customer.ID) INNER JOIN LookupQuoteIncludeType ON QuoteForecast.IncludeType = LookupQuoteIncludeType.IncludeID) INNER JOIN LookupQuoteStatus ON QuoteForecast.Status = LookupQuoteStatus.StatusID) INNER JOIN LookupSalesRep ON QuoteMaster.SalesRepID1 = LookupSalesRep.ID WHERE (((QuoteMaster.ID)= " & passId & "));"
Dim cmd As New SqlCommand(MySQL, myconn)
Dim reader As SqlDataReader
myConn.Open()
reader = cmd.ExecuteReader
While reader.Read()
lblQuoteID.Text = reader("QuoteMaster.ID") & String.Empty
lblCompany.Text = reader("CustomerName") & String.Empty
End While
lblCompany.text finds an entry and does not error out, but the first statement does: QuoteMaster.ID. Does anyone have any ideas? Do I have to read each table seperately or create a datatable or something?