Begining asp begining

E

Evertjan.

Haziq wrote on 05 apr 2010 in microsoft.public.inetserver.asp.general:
How to modyfy rs.Open "SELECT * FROM Customers WHERE
CustomerID=CustomerID",

There is no ASP-code only VBscript-code or Javascript-code on an ASP
platform. Below I will assume ASP-VBS.

" ... WHERE CustomerID=CustomerID" is not very logical,
how would the database enging know what customer it needs to look for?


Try:

sql = "SELECT * FROM tblCustomers WHERE CustomerID = " & CustomerID
response.write sql
response.end
''' Always first debug by writing the sql result string,
''' only if you are happy with that go on with:

set mD = CONNECT.Execute(sql)

if not mD.eof then
'' do what you must if found
else
response.write "No CustomerID "&CustomerID&" exists in tblCustomers"
end if
 
H

Haziq

What wrong with my asp coding ?
How to modyfy rs.Open "SELECT * FROM Customers WHERE CustomerID=CustomerID",
conn.
plz


<html>
<body>

<form method="get" action="testing04b.asp">
Client: <input type="text" name="CustomerID" /><br />
<br />
<input type="submit" value="Submit" />
</form>

</body>
</html>



----------------------------------
testing04b.asp

<html>
<body>

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "C:\Inetpub\wwwroot\iissamples\sdk\asp\database\northwind.mdb"
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT * FROM Customers WHERE CustomerID=CustomerID", conn


response.write(request.querystring("fname"))
response.write(CustomerID)



rs.close
conn.close


%>

</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top