Hai,
Now,I am learning ASP through MSAccess Database.I want to store and retrive an image.
To store an image i used OLE Object in the MSaccess database.
To store an image through ASP,i used the HTML \"input\" tag of type \"file\".we can specify the file name through brouse button.the output of the upload file is the rawdata + image,i seperated the image and stored in a variable.while
storing this in a database through asp code,I am getting this error.
Error Type:
Provider (0x80040E21)
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
/uploadfile.asp, line 33
so,give me the code for that or correct the code.
my id is
[email protected]
This is the code :
1)file.HTML
<FORM NAME="oForm"
ACTION="uploadfile.asp"
ENCTYPE="multipart/form-data"
METHOD="post">
<pre>
<INPUT TYPE="file" NAME="oFile1" Accept="image/*">
<br>
<INPUT TYPE="submit" VALUE="Upload File">
</pre>
</FORM>
2)uploadfie.asp [error]
<%
option explicit
Dim FormSize,FormData,bnCRLF,Divider,DataStart,DataEnd
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"
Dim Image
image = MIDB(FormData,DataStart,DataEnd)
'Response.BinaryWrite image
'Response.End
%>
<html>
<body>
<%
Dim con,conStr,rs,sQl
conStr =\"Provider =Microsoft.Jet.OLEDB.4.0;Data Source =C:\work\nag\website\databases\raw.mdb;Persist Security Info = False "
Set con = Server.CreateObject("ADODB.Connection")
con.open conStr
Set rs =Server.CreateObject("ADODB.RecordSet")
rs.open "select * from rawtable where 1=0",con,0,2,0
'If request.Servervariables("REQUEST_METHOD") = "POST" Then
rs.addNew
rs(1) =image
rs.UpdateBatch
dim sql1
sql1="insert into rawtable (rawtext) values(" + image +")"
'con.execute(sql1)
Response.write("<center><b>Inserted Successfully</b></center>")
'End If
%>
</Body>
</html>
3)database
Name of the database is raw.mdb
in the raw.mdb,a file named rawtext table is there.
the rawtext table contains two fields rawid and rawtext.
ok.
please help me.
WAITING FOR UR REPLY.
Bye.