I used this in my VB Program(.dll) and when I tried to access it from my
asp file it is giving type mismatch error in the line
rs.fields(FieldName).Value = mstream.read
Microsoft VBScript runtime error'800a000d'
Type Mismatch
I've my Field type in SQL as binary.
Please help me regarding this.
Thanks and Regards,
Naveen.
> If you're using ADO, AppendChunk has been replaced by something far
easier:
> the Stream.
>
> Public Sub SaveFileToField(FieldName As String, FileName As String,
> ConnectionString As String)
> Dim cn As ADODB.Connection
> Dim rs As ADODB.Recordset
> Dim mstream As ADODB.Stream
>
> Set cn = New Connection
> cn.open ConnectionString
>
> Set mstream = New Stream
> mstream.Type = adTypeBinary
> mstream.open
>
> mstream.LoadFromFile FileName
> rs.fields(FieldName).Value = mstream.read
> rs.Update
>
> rs.Close
> cn.Close
> Set rs = Nothing
> Set cn = Nothing
> End Sub
>
> Public Sub SaveFieldToFile(FieldName As String, FileName As String,
> ConnectionString As String)
> Dim cn As ADODB.Connection
> Dim rs As ADODB.Recordset
> Dim mstream As ADODB.Stream
>
> Set cn = New Connection
> cn.open ConnectionString
>
> Set mstream = New Stream
> mstream.Type = adTypeBinary
> mstream.open
>
> mstream.write rs.fields(FieldName).Value
> mstream.SaveToFile FileName, adSaveCreateOverwrite
>
> rs.Close
> cn.Close
> Set rs = Nothing
> Set cn = Nothing
> End Sub
>
> > -----Original Message-----
> > From: Tim Mccurdy [mailto:tmccurdy@c...]
> > Sent: Tuesday, August 14, 2001 10:57 AM
> > To: professional vb
> > Subject: [pro_vb] RE: saving Image to SQL Server
> >
> >
> > You have to use a Binary Field in the Database and then use the
> > "AppendChunk" method of ADO. There is plenty of Help available
> > for that in
> > MSDN, do a Search on "Image in Database".
> >
> > -----Original Message-----
> > From: Vinod Thomas [mailto:vthomas@a...]
> > Sent: Tuesday, August 14, 2001 9:43 AM
> > To: professional vb
> > Subject: [pro_vb] saving Image to SQL Server
> >
> >
> > Hi,
> > How can I save an image file to the SQL Server database. I cannot
> > use recordset( May be I am wrong) update since I am suing RDS
> > componets in
> > my apps.
> > I am trying to execute an Insert, update from the client, but if I use
> > the byte varaible along woth the SQL statement it gives me a type
mismatch
> > This seems to be very common, sorry I couldn't find any answers
> > Thanks for your help
> > Vinod
>