473,672 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Long Raw Type Mismatch error

I'm new to using long raw fields with ASP. I know it would be easier
to leave the files on the file system, but the client wants them in
the database. Based on what I've read so far, I have used the
following code to read files from a hard drive and stuff them in the
database.

<%

'============== =============== =============== =============== =============== ==========
'Function to read a binary file from disk
Function ReadBinaryFile( FileName)
Const adTypeBinary = 1

'Create Stream object
Dim BinaryStream
Set BinaryStream = CreateObject("A DODB.Stream")

'Specify stream type - we want To get binary data.
BinaryStream.Ty pe = adTypeBinary

'Open the stream
BinaryStream.Op en

'Load the file data from disk To stream object
BinaryStream.Lo adFromFile FileName

'Open the stream And get binary data from the object
ReadBinaryFile = BinaryStream.Re ad
End Function

'============== =============== =============== =============== =============== ==========
' MAIN

dim objConn
DBObjConn() 'Open database
Set RS = CreateObject("A DODB.Recordset" )
SQL = "SELECT * FROM pictures WHERE 1=0"

objConn.beginTr ans

RS.Open SQL, objConn, adOpenKeyset, adLockOptimisti c, adCmdText

Set FileSystem=Crea teObject("Scrip ting.FileSystem Object")
root = Request.ServerV ariables("APPL_ PHYSICAL_PATH")
rootFilePath = root & "IQInputSource\ crt_AGT1500"
filepath = FileSystem.GetA bsolutePathName (rootFilePath)
Set folder=FileSyst em.GetFolder(fi lepath)
Set objFileList = folder.Files

for each objFile in objFileList
filename = objFile.Name
gfxSpex objFile.Path, width, height, depth, filetype
If InStrRev( LCase(filename) , ".gif" ) OR InStrRev( LCase(filename) ,
".jpg" ) THEN
partnumber = Left(filename, InStr(filename, ".")-1 )
RS.AddNew
RS("vcpartnumbe r") = partnumber
RS("width") = width
RS("height") = height
RS("vcfiletype" ) = filetype
RS("imagedata") .appendChunk( ReadBinaryFile( objFile.Path) )
RS.update
End If
next

RS.close

objConn.commitT rans
%>
This seems to work fine, however, when I try and pull the images out
again, it doesn't always work. Some images come out and display just
fine others give me the following error.

error 'ASP 0106 : 80020005'
Type Mismatch, line 18
An unhandled data type was encountered.

Why would I get this only with some rows and not all of them? I
thought maby file size had something to do with it, but after doing
some checking, that doesn't seem to be the case. The code I'm using to
retrieve the data is pretty much straight from Microsoft's site.

<%
dim objConn
DBObjConn() 'Open database

id = Request.QuerySt ring("id")

cmdsql = "SELECT imagedata, vcfiletype from pictures WHERE
vcpartnumber ='"&id&"'"
set rs = Server.CreateOb ject("adodb.Rec ordset")
rs.open cmdsql, objConn

Response.Conten tType = "image/" & rs("vcfiletype" )

Response.Expire s = 0
Response.Buffer = TRUE
Response.Clear

temp = rs("imagedata" )
Response.Binary Write temp
Response.End
%>
Any help is greatly appreciated.

-Sean
Jul 19 '05 #1
0 3476

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4432
by: Arun Wadhawan | last post by:
Hello MY SQL Server is causing me this problem : Microsoft VBScript runtime error '800a000d' Type mismatch: 'ident' >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> I am getting from the table datingnew the value of the ident field.
4
11961
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column 14 (STDCOST). ---End Error Msg--- The STDCOST is set to decimal (28,14) and is a formatted in Access as a number, single with 14 decimal. I don't know why I would be getting a Type
0
2246
by: news.paradise.net.nz | last post by:
I have been developing access databases for over 5 years. I have a large database and I have struck this problem with it before but can find nothing in help or online. Access 2000 I have a query that will run fine without any criteria but as soon as I add any criteria it gives a "Data type mismatch" error. As soon as I remove any criteria it runs perfectly. I know this query is based on another query but I have other processes based on...
4
3659
by: Robert Hanson | last post by:
Hi All, I am trying to add a record to a datatable that is connected to an Access database. I had no trouble with string and date fields, but for this record, I have two Long Integer field types and I get the following error: "Data type mismatch in criteria expression." I am using OleDbType.Integer as the type which matched the Int32 size for the Long Integer in Access, but I can't seem to get past the error.
1
3276
by: amitbadgi | last post by:
I am getting the following error while converting an asp application to asp.net Exception Details: System.Runtime.InteropServices.COMException: Data type mismatch in criteria expression. Source Error: Line 233: Line 234: rs =
3
2911
by: amitbadgi | last post by:
I am getting teh following error while converting an asp application to asp.net, Exception Details: System.Runtime.InteropServices.COMException: Type mismatch. Source Error: Line 347: 'response.Write(sql2)
1
2806
by: Brett | last post by:
I have a form that calls a method within a DLL. By clicking a button on the form, the DLL is instantiated and the SaveOutlookMessage() method invoked. The DLL code copies messages from Outlook to an HTML file. When I execute the EXE, which is only the form, and click the button, I get a "Type Mismatch" error on this line in the form: mailobj.SaveOutlookMessage() Any suggestions on why I'm getting the type mismatch error? --Form code
6
5985
by: Howard Kaikow | last post by:
I'm doing a VB 6 project in which I am trying to protect against type mismatch errors. Is the process any different in VB .NET? Here's what I'm doing in VB 6. I have an ActiveX DLL. The class has stuff initialized by calling a sub SetClass that wants some Word specific objects passed-in. If the user mistakingly uses the wrong object, say, uses an Excel object
19
5536
by: zz12 | last post by:
Hello, is there a setting in IIS 5.0 that would quickly fix the following error?: Microsoft VBScript runtime (0x800A000D) Type mismatch It's strange because some of our .asp pages were working fine for the past years but recently our website was updated in that old folders were renamed and the new ones took on the existing name and was wondering why some our ..asp pages are now returning this error? I would think that since the code
0
8832
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8611
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8685
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7449
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6240
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2821
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1819
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.