ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 27th, 2003, 02:33 AM
bingbing bingbing is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 6 bingbing User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to bingbing
SQL statement parsing problem with Oracle

To anyone whose reading this,

I feel that it's appropriate to explain the logic of my code and what I actually intend to do with my SQL statement.

I have the following tables in my database:
Publications:
PUB_ID PUBLICATIONS
---------- ------------------
2 Star

Category:
CAT_ID CATEGORY
---------- ----------------
4 Business

ArticleDate:
DATE_ID ART_DATE
---------- ---------
1 10-JUL-03

Keyword:
KEYWORD_ID KEYWORDS
----------- ----------------
1 Bank,Merger

Link:
AID LINK
---------- -----------------------------------
2411 C:\Inetpub\wwwroot\Oracle\file.mht


Hence, what I intend to achieve is that when a user selects Star, Business, 10-JUL-03, Bank,Merger from the interface, the ASP page would return the values
PUB_ID = 2
CAT_ID = 4
DATE_ID = 1
KEYWORD_ID = 1

From my ASP code below, I concatenate the four values to become 2411 which i put in a variable called CNT.
Hence, from the SQL statement, it would look up from table Link and find LINK.AID=2411. Finally I should be able to display the link to that file.

The following is my code (which doesn't return any results):

<HTML>
<HEAD></HEAD>

<BODY>
<%
'Connection using execute method and a string variable
Dim connectionToDatabase, strconnection, recordset
Dim AD, KW, Pub, Cat, CNT
Dim strSQL

strDay = Request.Form("Day")
strMonth = Request.Form("lstMonths")
strYear = Request.Form("Year")

AD = strDay & "-" & strMonth & "-" & strYear
KW = Request.Form("Keyword")
Pub = Request.Form("Publication")
Cat = Request.Form("Category")
CNT = "PUBLICATIONS.PUB_ID" & "||" & "CATEGORY.CAT_ID" & "||" & "ARTICLEDATE.DATE_ID" & "||" & "KEYWORD.KEYWORD_ID"

strconnection = "PROVIDER=OraOLEDB.Oracle; Data Source=databasename; User ID=user; PASSWORD=password;"
strSQL="Select LINK.LINK, PUBLICATIONS.PUB_ID, CATEGORY.CAT_ID, ARTICLEDATE.DATE_ID, KEYWORD.KEYWORD_ID from LINK, PUBLICATIONS, CATEGORY, ARTICLEDATE, KEYWORD where PUBLICATIONS.PUBLICATIONS='"&Pub&"' and CATEGORY.CATEGORY='"&Cat&"' and ARTICLEDATE.ART_DATE='"&AD&"'and KEYWORD.KEYWORDS='"&KW&"' and LINK.AID="&CNT&""

Set connectionToDatabase=Server.CreateObject("ADODB.Connection")
connectionToDatabase.open strconnection

Set recordset=connectionToDatabase.Execute(strSQL)

While Not recordset.EOF

%><a href="<%Response.Write(recordset("LINK"))%>"><%Response.Write(recordset("LINK"))%></a><%
Response.Write("<BR>")
recordSet.MoveNext

Wend

' Close our recordset and connection and dispose of the objects
connectionToDatabase.Close
Set connectionToDatabase = Nothing

%>


</BODY>
</HTML>

My goal's to display C:\Inetpub\wwwroot\Oracle\file.mht on my web browser (IE 6 or Netscape)when I click the submit button.
Tried checking using Response.Write strSQL and copy&pasted
the string and ran it thru my database. It works and gives me the correct result.
I really need help on this. Been stuck at this problem (not able to display anything on my results page) for weeks...
If anyone out there knows the problem with my code do post a reply or email me at hcbing@yahoo.com
Thanks a lot of all your help!!!

Reply With Quote
  #2  
Old July 27th, 2003, 03:00 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 44 m 30 sec
Reputation Power: 8
Suggestion: Use the Oracle profiler tools to record what statement is being sent to the database.
Question: Does the user running the query have SELECT access to the target tables?
Are you trapping all SQL errors?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > SQL statement parsing problem with Oracle


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway