?
Solved

Persits ASP Upload

Posted on 2005-03-14
9
Medium Priority
?
893 Views
Last Modified: 2012-08-13
I am testing this script to upload files from ASP. I get the following error

Persits.Upload.1 error '800a0018'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/odbc_upload.asp, line 37



<%
Dim Conn, strDataPath, strConnectString, strSQL
Set Upload = Server.CreateObject("Persits.Upload")
strDataPath = "c:\test\aspupload.mdb"
strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;"_
          + " Data Source= " & strDataPath & ";"_
          + " Mode=Share Deny None;User Id=admin;PASSWORD=;"
set Conn=Server.CreateObject("ADODB.Connection")
Conn.ConnectionTimeout = 15
Conn.CommandTimeout =  10
Conn.Mode = 3

if Conn.state = 0 then
     Conn.Open strConnectString
end if

      ' Capture files
      Upload.Save "c:\test\aspupload.mdb"

      ' Obtain file object
      Set File = Upload.Files("THEFILE")
 ' Build SQL INSERT statement
  SQL = "INSERT INTO MYIMAGES(image_blob, filename, description, filesize) VALUES(?, '"
  SQL = SQL & File.Filename & "', '"
  SQL = SQL & Replace(Upload.Form("DESCR"), "'", "''") & "', "
  SQL = SQL & File.Size & ")"

  ' Save to database
  File.ToDatabase strDataPath, strConnectString, SQL
   
            ' Save to database
            File.ToDatabase strDataPath, SQL
            Response.Write "File saved."
if IsObject("Conn") then
     if not Conn is Nothing Then
          if Conn <> 0 then
               Conn.close
          end if
          set Conn = Nothing
     end if
end if
%>
0
Comment
Question by:RecipeDan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 13

Expert Comment

by:jrram
ID: 13541850
         if Conn <> 0 then
               Conn.close
          end if

should this if statement be "if Conn.state" or " if Conn.mode"?
0
 
LVL 15

Expert Comment

by:gladxml
ID: 13541944
I think this

File.ToDatabase strDataPath, strConnectString, SQL

should be like this

File.ToDatabase strDataPath, Conn, SQL
0
 
LVL 15

Accepted Solution

by:
gladxml earned 1000 total points
ID: 13541950
Ok try the code below with some revision

<%@LANGUAGE="VBSCRIPT">
<%
Dim Conn, strDataPath, strConnectString, strSQL
Set Upload = Server.CreateObject("Persits.Upload")
strDataPath = "c:\test\aspupload.mdb"
strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;"_
          + " Data Source= " & strDataPath & ";"_
          + " Mode=Share Deny None;User Id=admin;PASSWORD=;"
set Conn=Server.CreateObject("ADODB.Connection")
Conn.ConnectionTimeout = 15
Conn.CommandTimeout =  10
Conn.Mode = 3

     Conn.Open strConnectString


     ' Capture files
     Upload.Save "c:\test\aspupload.mdb"

     ' Obtain file object
     Set File = Upload.Files("THEFILE")
 ' Build SQL INSERT statement
  SQL = "INSERT INTO MYIMAGES(image_blob, filename, description, filesize) VALUES(?, '"
  SQL = SQL & File.Filename & "', '"
  SQL = SQL & Replace(Upload.Form("DESCR"), "'", "''") & "', "
  SQL = SQL & File.Size & ")"

  ' Save to database
  File.ToDatabase strDataPath, Conn, SQL
   
          ' Save to database
          'File.ToDatabase strDataPath, SQL
          Response.Write "File saved."
         
             Conn.close
         set Conn = Nothing
%>
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:RecipeDan
ID: 13557100
Thanks i'll try the code
0
 
LVL 1

Author Comment

by:RecipeDan
ID: 13562158
I am getting this error

Line 17 is     Upload.Save "c:\test\aspupload.mdb"



Persits.Upload.1 error '800a0005'

The system cannot find the path specified.

/odbc_upload.asp, line 17
0
 
LVL 15

Expert Comment

by:gladxml
ID: 13589086
try to check out the link might help...

http://support.persits.com/show.asp?code=PS02011784
0
 
LVL 1

Author Comment

by:RecipeDan
ID: 13617144
Hi Gladxml:

I figured the problem out. I'll give you the points since you helped me and gave me food for thought.

Dan
0
 
LVL 1

Author Comment

by:RecipeDan
ID: 13617148
Please note that the accepted answer is not the correct answer.
0
 
LVL 15

Expert Comment

by:gladxml
ID: 13634885
Why a grade of C?

try to check out the link regarding the right grade to give.
http://www.experts-exchange.com/help.jsp#hi73

Also it would be best the solution here so that other might use it for reference.  

Happy programming...
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question