|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 <code> <% 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 & "'" %> </code> 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 |
|
#2
|
||||
|
||||
|
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 Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
|
#3
|
|||
|
|||
|
HI sfaiz2001
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: <code> <%mySQL1 = "SELECT * FROM VIEW_NAME"%> </code> WHere VIEW_NAME is the above mentioned view. Hope this could help. Regards. |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > sql query in an asp page |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|