W
weiwei
Hi All
I want to upload either image or word document into either access or
SQL server database
so far I am doing some small testings and what I can do is upload the
file from first page and display at the next
page with (both image or word are working fine).
however, I cann't insert them into the database, Plus, what type
should I use in access database?
anyone who has this type of project, please help me out
below is my current test code
<%
FormSize = Request.TotalBytes
FormData = Request.BinaryRead( FormSize )
'bnCRLF = chrB( 13 ) & chrB( 10 )
'Divider = LEFTB( FormData, INSTRB( FormData, bnCRLF ) - 1 )
'DataStart = INSTRB( FormData, bnCRLF & bnCRLF ) + 4
'DataEnd = INSTRB( DataStart + 1, FormData, divider ) - DataStart
'Response.ContentType = "image/gif"
'Response.ContentType = "application/msword"
'Response.BinaryWrite MIDB( FormData, DataStart, DataEnd )
'Response.BinaryWrite FormData
%>
<!--Create and Open the Databse Connection-->
<% Set connCW = Server.CreateObject("ADODB.Connection") %>
<% connCW.Open ="Driver={Microsoft Access Driver (*.mdb)}; " &_
"DBQ=" & Server.Mappath("track.mdb") %>
<%
sql = "INSERT INTO upload (FileName) VALUES('" & FormData & "')"
Set rs = connCW.Execute(sql)
%>
I got error saying type mismatch
thanks in advance
wei
I want to upload either image or word document into either access or
SQL server database
so far I am doing some small testings and what I can do is upload the
file from first page and display at the next
page with (both image or word are working fine).
however, I cann't insert them into the database, Plus, what type
should I use in access database?
anyone who has this type of project, please help me out
below is my current test code
<%
FormSize = Request.TotalBytes
FormData = Request.BinaryRead( FormSize )
'bnCRLF = chrB( 13 ) & chrB( 10 )
'Divider = LEFTB( FormData, INSTRB( FormData, bnCRLF ) - 1 )
'DataStart = INSTRB( FormData, bnCRLF & bnCRLF ) + 4
'DataEnd = INSTRB( DataStart + 1, FormData, divider ) - DataStart
'Response.ContentType = "image/gif"
'Response.ContentType = "application/msword"
'Response.BinaryWrite MIDB( FormData, DataStart, DataEnd )
'Response.BinaryWrite FormData
%>
<!--Create and Open the Databse Connection-->
<% Set connCW = Server.CreateObject("ADODB.Connection") %>
<% connCW.Open ="Driver={Microsoft Access Driver (*.mdb)}; " &_
"DBQ=" & Server.Mappath("track.mdb") %>
<%
sql = "INSERT INTO upload (FileName) VALUES('" & FormData & "')"
Set rs = connCW.Execute(sql)
%>
I got error saying type mismatch
thanks in advance
wei