I just need to fix a couple of bad records. I am able to swap the month with the year and re-encrypt. But when I try and put it into the MS SQL SERVER varbinary field again it is getting truncated. What is the correct way to update the table with the new encrypted values?
Conn.Open strDSN
Dim sql : sql = "Select * FROM tmpRefill WHERE CC <> 'NULL' AND CustId = 9944"
rs.Open sql, Conn
Dim custId, email, cc, newCC, upSQL
Do Until rs.EOF
Response.Write rs("CustId")
Response.Write("<br />")
Response.Write rs("email")
Response.Write("<br />")
cc = EnCrypt(rs("CC"))
Response.Write cc
Response.Write("<br />")
cc = Split(cc,"-")
newCC = cc(0) & "-" & cc(2) & "-" & cc(1) & "-" & cc(3)
Response.Write newCC
Response.Write("<br />")
newCC = EnCrypt(newCC)
Response.Write newCC
Response.Write("<br />")
Response.Write("<br /><br />")
rs.MoveNext
Loop
upSQL = "UPDATE tmpRefill SET CC = CONVERT(VARBINARY(500), '" & newCC & "') WHERE CustId = 9944"
Conn.Execute (upSQL)
The datatype on the table column is varbinary(500) so I dont understand why I have to convert it to insert it.