Passing a Byte Array from Client to Server

Results 1 to 3 of 3

Thread: Passing a Byte Array from Client to Server

  1. #1
    Swaminathan Guest

    Default Passing a Byte Array from Client to Server

    Hello,<BR><BR>I am trying to pass an Array of Bytes from the Client side to the Server and store it<BR>into an SQL database.<BR><BR>I am basically using a Variant containing the array of Bytes.<BR><BR>My COde looks like this<BR><BR>con.Open "DSN=DSNName;UID=UserName;PWD=Password"<BR><BR > Set cm = CreateObject("ADODB.Command")<BR> cm.ActiveConnection = con<BR> cm.CommandText ="INSERT INTO TableName(ByteArray) VALUES (?)" <BR><BR><BR> Set objparam=cm.createparameter(ByteArray, 8209, ,6500 ,Request.Form("ArrayofBytes"))<BR> &#039 8209=Data type for a Variant containing an array of bytes<BR> &#039 6500 = max length of the Array<BR> cm.parameters.append objparam<BR><BR> con.Execute("Delete From TableName") &#039 Delete existing record and overwrite<BR> cm.Execute<BR> <BR> con.Close <BR><BR><BR>Everything works fine till cm.Execute when I get an error message as follows<BR>Provider error &#039 80040e30&#039 <BR>Type name is invalid. <BR><BR>The field in the SQL Table is of type image (but text, ntext do not work either).<BR><BR>Thanks in advance for any help.<BR><BR>Regards<BR>Swamy

  2. #2
    Join Date
    Dec 1969

    Default RE: Passing a Byte Array from Client to Server

    The Data type is not correct. I don&#039t see 8209 in my list of DataTypeEnums. Try 204 (adVarBinary) or 128 (adBinary). You can always try 12 (adVarient) too, but it is not supported by ADO and might cause unpredictable results.<BR>Good luck,<BR>SamC

  3. #3
    Swaminathan Guest

    Default RE: Passing a Byte Array from Client to Server

    Hi SamC,<BR><BR>Thanks for your reply.<BR><BR>I have tried adVarBinary, adLongVarBinary, adBinary and adVariant.<BR>With all these combinations I get a "Type mismatch" error right at the Set objparam=cm.createparameter(ByteArray, ...<BR>stage itself .<BR><BR>A VarType(ArrayofBytes) gives me the value of 8209.<BR><BR>I guessed this must be a combination like <BR>adArray &#124 adUnsignedTinyInt which is 0x2000 &#124 0x11 which gives me the 8209.<BR><BR>With this the &#039Type Mismatch error&#039 was overcome but now I have a provider error<BR><BR>Regards<BR>Swamy<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts