October 28th, 2003, 05:13 AM
sql query in an asp page
hi..i am trying to read in record from a databse located in the web server...
i am trying to do this sql query in an asp page..so this is an asp code...i have written the code as this
mySQL1 = "select b.BookingNum,c.Title,c.Fname,c.Lname,c.HouseNum,c.Street,c.Suburb,c.State,c.Postcode,c.Phone,"
mySQL1 = mySQL1 & "RR.RmType,RB.RoomNum,s.ServiceType from Customer c,Bookings b,RoomBooking RB,"
mySQL1 = mySQL1 & "RoomRates RR, SuppBooking SB, Services s where c.CustomerID=b.CustomerID and "
mySQL1 = mySQL1 & "b.BookingNum=RB.BookingNum and SB.SuppServiceID=s.SuppServiceID and RB.RmTypeCode=RR.RmTypeCode and "
mySQL1 = mySQL1 & "b.BookingNum= '" & bnn & "'"
just asking that is there any thing wrong with this sql query....because my page isn;t showing...and i donno if it is the right way to connect different tables...please help
October 28th, 2003, 01:10 PM
The best way to debug this would be to print mySQL1 to the browser, after you've completed constructing the query. Then, run the query from query analyzer and see if it returns any results. That will tell you if you're constructing the query properly or not.
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
November 22nd, 2003, 06:25 AM
It seems to be a "JOIN" problem. If i've had correctly understood, you're triing to brig data from different tables (C,RR,RB,SB,S). I suggest you to proceed as follows:
1) Build a VIEW in sql that joins data you need and test if the data you want are or not correctly displayed.
2) Simply recall the view by the following code:
<%mySQL1 = "SELECT * FROM VIEW_NAME"%>
WHere VIEW_NAME is the above mentioned view.
Hope this could help.