uploading file into sql 2005 using .asp
uploading file into sql 2005 using .asp
am 19.07.2006 10:27:16 von jo uy
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
Re: uploading file into sql 2005 using .asp
am 19.07.2006 13:24:56 von reb01501
jo uy wrote:
> 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
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.
--
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"
Re: uploading file into sql 2005 using .asp
am 19.07.2006 18:13:24 von jo uy
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....
"Bob Barrows [MVP]" wrote in message
news:OZ7o0XyqGHA.4684@TK2MSFTNGP05.phx.gbl...
> jo uy wrote:
>> 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
>
> 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.
>
> --
> 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"
>
Re: uploading file into sql 2005 using .asp
am 19.07.2006 19:19:08 von reb01501
jo uy wrote:
> 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
>
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?
--
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.
Re: uploading file into sql 2005 using .asp
am 19.07.2006 20:42:55 von Patrice
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;Q258 038
Finally you may want to check if the cursort type you have is the same than
with the 2000 application...
Good luck.
--
Patrice
"jo uy" a écrit dans le message de news:
%23OTes40qGHA.3648@TK2MSFTNGP03.phx.gbl...
> 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....
>
>
> "Bob Barrows [MVP]" wrote in message
> news:OZ7o0XyqGHA.4684@TK2MSFTNGP05.phx.gbl...
>> jo uy wrote:
>>> 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
>>
>> 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.
>>
>> --
>> 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"
>>
>
>