Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / Database Access / July 2006



Tip: Looking for answers? Try searching our database.

uploading file into sql 2005 using .asp

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jo uy - 19 Jul 2006 09:27 GMT
Hi,

Anyone who can send me a sample code of how to upload a file into SQL 2005
server using .asp running on IIS 6?

I have a code that has been working when uploading into SQL 2000 but when I
do the migration to SQL 2005, it doesn't work anymore.

Thanks
Bob Barrows [MVP] - 19 Jul 2006 12:24 GMT
> Hi,
>
[quoted text clipped - 5 lines]
>
> Thanks

Please do not multipost. Pick one newsgroup and stay with it unless advised
to take your question elsewhere.
Actually, this is the more appropriate group for this question, so I'm going
to suggest that we carry on the conversation here. Again, in .asp.general, I
posted this reply to your question:

------------------
First, you need to define "upload a file". Are you talking about storing the
file in an image column in a table in the database? Or are you talking about
parsing a csv file and storing the data in separate columns?
------------------

and Patrice posted this:
---------------------
IMO just tell what is the message you have with the appropriate section of
code and telling us which exact line raises the error...

It could be also a configuration error, a sample could not do exactly what
you want (for example it's not clear if the upload problem arises between
the browser and the web server or between the web server and the database)
and even if it works you perhaps won't know what was wrong...
--------------------

Posting a reply to Patrice's question will effectively answer my question as
well.

Signature

Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

jo uy - 19 Jul 2006 17:13 GMT
hi,

this is the part where it's giving me error

rstrNewFiles.AddNew
                     rstrNewFiles("ProjectNo") = strprojNumber
                     rstrNewFiles("projectID") = Uploader.Form("ProjNo")
                     rstrNewFiles("FileName") = File.FileName
                     rstrNewFiles("FileSize") = File.FileSize
                     rstrNewFiles("CreatedBy") = strUSer
                     rstrNewFiles("IPAddress") = varIPAddress
                     rstrNewFiles("DateCreated") = strDateCreated
                     If varFileExtension = "doc" then
                           rstrNewFiles("ContentType") =
"application/msword"
                     Else
                           rstrNewFiles("ContentType") = File.ContentType
                     End if
                     rstrNewFiles("FileData").AppendChunk File.FileData
line 138          rstrNewFiles.Update
                     rstrNewFiles.Close

and the error is

Microsoft OLE DB Provider for ODBC Drivers error '80040e23'
[Microsoft][ODBC SQL Server Driver][SQL Server]The cursor does not include
the table being modified or the table is not updatable through the cursor.
line 138

take note that this code works perfectly well when inserting into SQL 2000
DB.

Thanks....

>> Hi,
>>
[quoted text clipped - 33 lines]
> Posting a reply to Patrice's question will effectively answer my question
> as well.
Bob Barrows [MVP] - 19 Jul 2006 18:19 GMT
> hi,
>
[quoted text clipped - 24 lines]
> include the table being modified or the table is not updatable
> through the cursor. line 138

This usually indicates the lack of a primary key on the table being
updated.

Have you considered using a stored procedure instead of a cursor?

Signature

Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Patrice - 19 Jul 2006 19:42 GMT
I also noticed that you are using the ODBC driver (any reason ?). Which
driver are you using (could it tbe the SQL Server 2000 driver) ? If not
already done you may want to try the new SQL Native Client provides both a
new OLEDB provider and ODBC driver :
http://support.microsoft.com/kb/910016/en-us

As a side note I thought you had to do this in several chunks (what is the
size of your file ?). My personal preference was to use the ADODB.Stream
object  (and the SQLOLEDB provider) :
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q258038

Finally you may want to check if the cursort type you have is the same than
with the 2000 application...

Good luck.

Signature

Patrice

> hi,
>
[quoted text clipped - 70 lines]
>> Posting a reply to Patrice's question will effectively answer my question
>> as well.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.