Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Displaying Data from Two Table
Old 11-19-2004, 11:54 AM Displaying Data from Two Table
barbara's Avatar
Skilled Talker

Posts: 79
Trades: 0
i have a plain html page containing a form asking which tests request no the user wish to view then submit to an asp page for processing.

asp page:

<%
dim TestRequest

TestRequest = request.form ("txtTestRequestNo")

set conn=server.createobject("adodb.connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/inetpub/wwwroot/database/HTC.mdb"

sql="Select * from tblCustomers, tblAbrasions where CustID=ID AND TestRequestNo = TestRequest"

Set rs=conn.execute(SQL)
%>

i got the following error when i add the part "AND TestRequestNo = TestRequest":

Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.
/project/report-sample.asp, line 18


without adding the part "AND TestRequestNo = TestRequest"; it just display all available test request nos (with its information), but i only want to display the request test requests by the user.

thanks
barbara is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-19-2004, 09:57 PM
vivekar's Avatar
Webmaster Talker

Posts: 612
Trades: 0
You must use the ASP concatenation like

"Select * from tblCustomers, tblAbrasions where CustID=" & ID & " AND TestRequestNo = " &TestRequest & " "

BTW, on your connection string. It is wierd.

I use it like
Code:
gblDB = "c:/inetpub/wwwroot/database/HTC.mdb"
Set gblConn	= Server.CreateObject("ADODB.Connection")
gblDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" &_
				          "Persist Security Info=False;" &_
				          "Data Source=" & gblDB
gblConn.Open gblDBConnString
__________________

Please login or register to view this content. Registration is FREE
(Active since 2003) |
Please login or register to view this content. Registration is FREE
vivekar is offline
Reply With Quote
View Public Profile Visit vivekar's homepage!
 
Old 11-22-2004, 10:37 AM
barbara's Avatar
Skilled Talker

Posts: 79
Trades: 0
now i got this error message:

Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression 'CustID= AND TestRequestNo = TS3000'

with the changing code as:

dim TestRequest

TestRequest = Request.Form ("txtTestRequestNo")
response.write TestRequest


gblDB = "c:/inetpub/wwwroot/database/HTC.mdb"
Set gblConn = Server.CreateObject("ADODB.Connection")
gblDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Persist Security Info=False;" &_
"Data Source=" & gblDB
gblConn.Open gblDBConnString

sql="Select * from tblCustomers, tblAbrasions where CustID= " &ID& " AND TestRequestNo = " &TestRequest & " "

Set rs=gblconn.execute(SQL)
%>

---------------------------------------

when i take out the parenthesis around "ID":

sql="Select * from tblCustomers, tblAbrasions where CustID= ID AND TestRequestNo = " &TestRequest & " "

it gives me this error message:

Error Type:
Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.
/project/report-sample1a.asp, line 22


thanks
barbara is offline
Reply With Quote
View Public Profile
 
Old 11-22-2004, 05:16 PM
barbara's Avatar
Skilled Talker

Posts: 79
Trades: 0
I finally got it to work with slight modification to the sql statement:

sql="Select * from tblCustomers, tblAbrasions where ID = CustID and TestRequestNo = '" &TestRequest& "'"

thanks

Last edited by barbara; 11-23-2004 at 09:35 AM..
barbara is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Displaying Data from Two Table
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30627 seconds with 12 queries