title: Convert Byte Array to String value in vbscript
body: <p>I have a logTable in my database for log changes on someTable. </p>
  
  <p>logTable has three columns: </p>
  
  <p>first for store column name which value was changed;<br>
  second for old value;<br>
  third for new value.</p>
  
  <p>Second and third column has sql_variant data type.</p>
  
  <p>In my program I get data from this table and oldValue and newValue are an arrays of bytes. </p>
  
  <p>For example:</p>
  
  <p>rows in logTable:</p>
  
  <pre><code>
  columnName(nvarchar(50)) oldValue(sql_variant)  newValue(sql_variant)
  
  compName    name1       name2
  address  "address1"  "address2"
  zip      123         134
  phone      123456789   987654321
  </code></pre>
  
  <p>But I get oldValue and newValue values in byte arrays.</p>
  
  <p>Like:</p>
  
  <pre><code>
  address "byte array"   "byte array"
  zip     "byte array"   "byte array"
  phone   "byte array"   "byte array"
  </code></pre>
  
  <p>instead:</p>
  
  <pre><code>
  address  "address1" "address2"
  zip     123         134
  phone    123456789   987654321
  </code></pre>
  
  <p>This code I use to get data from DB:</p>
  
  <pre><code>
  Set Conn = Server.CreateObject("ADODB.Connection")
  Conn.Open connStr
  Set rsData = Server.CreateObject("ADODB.Recordset")
  Set objComm = Server.CreateObject("ADODB.Command")
  Set objComm.ActiveConnection= Conn
  objComm.CommandText="usp_Log_GetOperationDetails"
  objComm.CommandType = adCmdStoredProc 
  objComm.Parameters.Append objComm.CreateParameter("@CompanyId",adInteger,adParamInput)
  objComm.Parameters("@CompanyId")=Request("CompanyId")
  objComm.Parameters.Append objComm.CreateParameter("@tableName",adVarChar,adParamInput, 50)
  objComm.Parameters("@tableName")=Request("tableName")
  rsData.CursorLocation = adUseClient
  rsData.CursorType = adOpenStatic
  Set rsData.Source = objComm
  rsData.Open
  
  If NOT rsData.EOF AND NOT rsData.BOF then
     Do While NOT rsData.EOF
      rsDataOldValue = rsData("OldValue")
      rsDatanewValue = rsData("NewValue")
          rsData.MoveNext
     Loop
  End If
  
  rsData.Close
  Set rsData = Nothing
  Conn.Close
  Set Conn = Nothing
  Set objComm = Nothing
  </code></pre>
  
  <p>How can I convert byte array to correct string value?</p>
  
  <p>Thanks</p>