|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > Updating image datatype |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|