Reply
Look for a record in access database/upload
Old 01-12-2008, 09:23 PM Look for a record in access database/upload
Skilled Talker

Posts: 77
I have a page that is supposed to display a certain piece of art, along with the title, description, and other thing, which are stored with an access database table.
Theres a page that you are sent to:
http://skeddles.com/pixel.asp?f=1
I want the page to look through the table in the ID column, find the number obtained from the url, and let me get the other information in that row.



Also, how do I upload a file and get the filename?
Skeddles is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 01-13-2008, 05:55 AM Re: Look for a record in access database/upload
chrishirst's Avatar
Super Moderator

Posts: 11,887
Location: Blackpool. UK
Quote:
Also, how do I upload a file and get the filename?
How to do both? or just get the filename from an uploader you are already using?

Quote:
I want the page to look through the table in the ID column, find the number obtained from the url, and let me get the other information in that row.
SELECT fieldlist FROM table WHERE table.id = [idVariable] ;
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-13-2008, 04:17 PM Re: Look for a record in access database/upload
Skilled Talker

Posts: 77
Um, I guess both.

and when i tried to use that, i got "Syntax error in FROM clause."
Theres probably a ton of things wrong with my code:
<%
dim i
i = request.querystring("f")
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
Conn.ConnectionString = "Data Source=" & Server.MapPath ("d/s.mdb")
Conn.Open

varf=Request.QueryString("f")

Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.Open "SELECT fieldlist FROM table WHERE table.id = [varf] ;", Conn, 1,3


%>
Skeddles is offline
Reply With Quote
View Public Profile
 
Old 01-13-2008, 04:51 PM Re: Look for a record in access database/upload
chrishirst's Avatar
Super Moderator

Posts: 11,887
Location: Blackpool. UK
"fieldlist" is a placeholder for a list of columns from YOUR table.

eg

SELECT title,description,author FROM

"table" should be replaced with YOUR table name

"table.id" should be replaced with YOUR table name and the column for the ID No

remove the [ ] from around the variable name and concatenate the variable value onto the string

eg

... mytable.id = " & varf & ";", conn, 1, 3


ENSURE THAT YOU "sanitise" the value coming from the querystring to minimise SQL injection attack risk, AND variables recovered from a form or querystring will be string. Your ID value is more likely to be an integer, so will need "casting" to an integer value with
Code:
varf=cint(Request.QueryString("f"))
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-13-2008, 04:57 PM Re: Look for a record in access database/upload
chrishirst's Avatar
Super Moderator

Posts: 11,887
Location: Blackpool. UK
Quote:
Um, I guess both.
Ok

take a look at
http://www.webmaster-talk.com/asp-fo...extension.html
&
http://www.webmaster-talk.com/asp-fo...file-size.html

for a somewhat modified asp file upload script.

Adding a name property to the class shouldn't be a problem.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-13-2008, 10:28 PM Re: Look for a record in access database/upload
Skilled Talker

Posts: 77
Quote:
Originally Posted by chrishirst View Post
Ok

take a look at
http://www.webmaster-talk.com/asp-fo...extension.html
&
http://www.webmaster-talk.com/asp-fo...file-size.html

for a somewhat modified asp file upload script.

Adding a name property to the class shouldn't be a problem.
I changed my mind, can you help with my previous script? Here it is:
Code:
<%
Dim oFileUp             

Set oFileUp = Server.CreateObject("SoftArtisans.FileUp")

oFileUp.Path = Server.MapPath("s")

If Not oFileUp.Form("myFile").IsEmpty Then

oFileUp.Form("myFile").Save
num=oFileUp.Form("myFile")

Response.Write ("File:")

path=oFileUp.Form("myFile").servername
filnum=len(myFile)
num=filnum

Response.Write(oFileUp.Form("myFile").ServerName)
response.write("<br>")
response.write (right(filnum,num))
response.write (num)

Else
Response.Write("Error: There was no file submitted for upload.")
End If


Set oFileUp = Nothing
%>
It gives me the path to the file on the server, but thats not what I wanted.
Skeddles is offline
Reply With Quote
View Public Profile
 
Old 01-14-2008, 12:03 AM Re: Look for a record in access database/upload
chrishirst's Avatar
Super Moderator

Posts: 11,887
Location: Blackpool. UK
In that case. You could always look at the SoftArtisans FileUp documentation.

http://support.softartisans.com/docs...erfilename.htm
or
http://support.softartisans.com/docs...rtfilename.htm
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Look for a record in access database/upload
 

Thread Tools

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
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.14390 seconds with 13 queries