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
Look for a record in access database/upload
Old 01-12-2008, 10:23 PM Look for a record in access database/upload
Extreme Talker

Posts: 176
Trades: 0
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
 
 
Register now for full access!
Old 01-13-2008, 06:55 AM Re: Look for a record in access database/upload
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-13-2008, 05:17 PM Re: Look for a record in access database/upload
Extreme Talker

Posts: 176
Trades: 0
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, 05:51 PM Re: Look for a record in access database/upload
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
"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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-13-2008, 05:57 PM Re: Look for a record in access database/upload
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-13-2008, 11:28 PM Re: Look for a record in access database/upload
Extreme Talker

Posts: 176
Trades: 0
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, 01:03 AM Re: Look for a record in access database/upload
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
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 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.53987 seconds with 12 queries