• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 901
  • Last Modified:

Persits ASP Upload

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
RecipeDan
Asked:
RecipeDan
  • 4
  • 4
1 Solution
 
jrramCommented:
         if Conn <> 0 then
               Conn.close
          end if

should this if statement be "if Conn.state" or " if Conn.mode"?
0
 
gladxmlCommented:
I think this

File.ToDatabase strDataPath, strConnectString, SQL

should be like this

File.ToDatabase strDataPath, Conn, SQL
0
 
gladxmlCommented:
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
RecipeDanAuthor Commented:
Thanks i'll try the code
0
 
RecipeDanAuthor Commented:
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
 
gladxmlCommented:
try to check out the link might help...

http://support.persits.com/show.asp?code=PS02011784
0
 
RecipeDanAuthor Commented:
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
 
RecipeDanAuthor Commented:
Please note that the accepted answer is not the correct answer.
0
 
gladxmlCommented:
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

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now