navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

RE: search database with the text file uploaded

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> RE: search database with the text file uploaded
Page: <<   < prev  1 [2]
 
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: search database with the text file uploaded - 2/3/2006 14:31:33   
Sorry if I'm intruding but I've been watching this post a little while and I'm of the opinion like dpf - why bother with an upload.

I threw together a quick script that will do what you want by posting a comma separated list of text values in a form and searches for the part and returns prices of each found part.

My test page is here:

http://www.clarkinsurance.com/54.asp

and I have setup a quick Access DB with 4 parts in it:

widget,muckaway valve,doohickey, and gadget

Try entering any of those values separated by commas (no extra words like "and") and posting the form. It will return prices of those it found in the list.

Here is the complete code of this page:

<html>
<head>
<title>Untitled</title>

</head>
<body>

<form method="POST" action="54.asp" name="textForm">
  <p><input type="hidden" name="posting" value="y"><textarea rows="2" name="productName" cols="20"></textarea><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

<%
SUB CloseAll
   rstemp.close
   set rstemp=nothing
   conntemp.close
   set conntemp=nothing
END SUB

IF request.form("posting") = "y" THEN

Set conntemp = Server.CreateObject("ADODB.Connection") 
myDSN="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("/fpdb/testproducts.mdb")
conntemp.Open myDSN 
mySQL = "SELECT * FROM tblProducts WHERE"

IF trim(Request.form("productName")&"") > "" THEN
	myTempString = ""
	myTempArray = split(trim(Request.form("productName")&""),",")
	FOR i = 0 TO ubound(myTempArray)
		myTempString = myTempString & "(productName = '" & trim(myTempArray(i)&"") & "') OR "
	NEXT
	myTempString = left(myTempString,len(myTempString)-4)
ELSE 'if they did not select or paste anything in
	myTempString = "(productName='QQQ')"
END IF
mySQL = mySQL & myTempString
set rstemp=conntemp.execute(mySQL)

IF  rstemp.eof THEN
	  Call CloseAll
	   response.write "No records matched<br>"
	   response.write "<br>Please try again."
	   'response.end
ELSE
		alldata = rstemp.getrows
		Response.write("<table>" & VbCrLf)
		FOR i = 0 TO ubound(alldata,2)
			Response.write("<tr><td>" & alldata(1,i) & "</td><td>" & alldata(2,i) & "</td></tr>" & VbCrLf)
		NEXT
		Response.write("</table>" & VbCrLf)		
END IF


END IF
%>

</body>
</html>


and the DB is a simple Access table with 3 fields: productID (PK autonumber), productName (text field), productPrice (double).

That any easier?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to karthik)
yogaboy

 

Posts: 377
Joined: 5/22/2004
Status: offline

 
RE: search database with the text file uploaded - 2/5/2006 8:13:51   
You're very welcome - we're not on a date!:)

I've been speaking to Karthik via email, but we're not getting very far. I've provided a working dll + files, all ready just to plug in, but I'm not surprised it's not working since I still haven't been given a sql select statement or column names or table names, or any of the other information I requested that might explain why it's not worked for Karthik.

Karthik, I suggest you stick to what you know, if you know classic ASP. RDouglass has provided a working and thoughtful answer so you should definitely use it.

(in reply to rdouglass)
karthik

 

Posts: 41
Joined: 8/16/2005
Status: offline

 
RE: search database with the text file uploaded - 2/8/2006 1:47:27   
Thanks everyone.

itz workin great

(in reply to yogaboy)
Page:   <<   < prev  1 [2]

All Forums >> Web Development >> ASP and Database >> RE: search database with the text file uploaded
Page: <<   < prev  1 [2]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts