Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 9th, 2004, 11:54 PM
mayankb mayankb is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 1 mayankb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Updating image datatype

i have to update a field in table1 which is of image datatype with
a field of table2 which is of the same type.problem is that the update
stmt. doesn't work for these data types.neither can we create temp. variables.
i tried retreiving this thru a stores procedure in ASP and then send as parameter
to another stored procedure to update the table.that doesnt work also.error msg id -
data type mismatch
any ideas how this can be done?
thanks for ur help

Reply With Quote
  #2  
Old May 10th, 2004, 08:36 AM
pdo pdo is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 pdo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You could try to do this using the ADODB.Stream object.

Code:
Set adoRSTable1 = Server.CreateObject("ADODB.Recordset")
adoRSTable1.Open "SELECT intPk, imgField FROM Table1 WHERE intPk = 1", _
			ConnStr, _
			adOpenForwardOnly, _
			adLockReadOnly
 
Set adoRSTable2 = Server.CreateObject("ADODB.Recordset")
adoRSTable2.Open "SELECT intPk, imgField FROM Table2 WHERE intPk = 1", _
			ConnStr, _
			adOpenKeyset, _
			adLockOptimistic
 
Set adoStream = Server.CreateObject("ADODB.Stream")
adoStream.Type = adTypeBinary
adoStream.Open

adoStream.Write adoRSTable1("imgField").Value
adoRSTable2("imgField").Value = adoStream.Read

adoRSTable2.Update
adoStream.Close
Set adoStream = Nothing
 
adoRSTable2.Close
Set adoRSTable2 = Nothing

adoRSTable1.Close
Set adoRSTable1 = Nothing


The values for the constants used are:
Code:
adOpenForwardOnly = 0
adOpenKeyset = 1
adLockReadOnly = 1
adLockOptimistic = 3
adTypeBinary = 1

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Updating image datatype


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT