Anyone help me please ? This is on an MX6.1 (with updater) server and
SQL 2000.

Up until now, I've been using a bit of code to convert SQL server binary
timestamps to text, storing them as a form field and then converting
them back to binary data when updating the record. I'd then catch any
errors in a stored procedure, in particular different timestamps to
ensure the record hadn't been updated since we "checked it out".

Now, the code has started giving me an error saying that my hexadecimal
value is invalid.. I use some modified code from CFLib:-

Original stored proc results:
Binary data: 0000180-99-98

Convert using udf:
TimeStampToHex(myQuery.TimeStamp)
-----
function TimeStampToHex(timestamp)
{
        // Take a timestamp and convert it to a string, then to a hex
representation
        // of itself ready for injecting back into a stored procedure as
a CF_SQL_BLOB
        BinaryString = toString(timestamp);
        myHex = "";
        for(i = 1; i le 8; i = incrementvalue(i))
                {
                        myValue = asc(mid(BinaryString, i, 1));
                        myHex = myHex & right("00" &
DecToHex(myValue),2);
                }
        return myHex;
}

// Convert decimal to HEX value
function DecToHex(str){
  return Ucase(FormatBaseN(str, 16));
}
-----

Converted value:
<input type="hidden" name="timestamp" value="0000000001509D9E">

Written back to DB using:  
<cfprocparam type = "IN" cfsqltype="CF_SQL_BLOB"
value="#Attributes.TimeStamp#"/>

Now, I know there's an option for returning timestamps as string when
setting up a datasource but this doesn't seems to be available for SQL
Server, only Access. I'm sure I'd seen it on SQL server previously but
don't have an MX6.0 or v5 server to refer to.

So, does anyone have a reliable way to convert t/s to string and back or
is there a hack to make it work. I've tried altering neoquery.xml but
with no luck. I've also tried Macromedia's article
http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_18324

Thx in advance 

Martin Parry
Macromedia Certified Developer
http://www.BeetrootStreet.co.uk




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase Studio MX with Flash Pro from House of Fusion, a Macromedia Authorized 
Affiliate and support the CF community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=51

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190618
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to