How to read binary in MSSQL 2005

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • programmer27
    New Member
    • Nov 2007
    • 3

    #1

    How to read binary in MSSQL 2005

    i've been reading this binary files in this database still no luck.
    it's not an ordinary binary file. coz there's no file you can see, it's all in the database. i'll attach here the database RanGame1. see the UserInven table -->UserInven having a binary data like this <binary data>
    i would like to read this.

    this displays when i'm reading it  @ @ @ @ 
    does anyone know exactly how to read this one?

    Download
    RanGame1 database

    i also attached screen shot of the database. help me guys
    thx in advance
    Attached Files
  • ak1dnar
    Recognized Expert Top Contributor
    • Jan 2007
    • 1584

    #2
    Hi,
    The Problem may not be with the database, may be its your scripts. Could you please show us the sample code snippets that you have used so far. Thanks.

    Comment

    • programmer27
      New Member
      • Nov 2007
      • 3

      #3
      yah it's my script not working.
      can u show me how to read it?

      heres my script. open3.php just opens the database
      [CODE=php]<?php
      //require "..\function.ph p";
      require "open3.php" ;
      $sql="SET TEXTSIZE 2147483647";
      $queryall="SELE CT * FROM UserInven ";

      if(!$result2 = mssql_query($qu eryall))
      print'cannot connect result';

      print'
      <table border=1> <tr>
      <td>
      ProductNum
      </td>
      <td>
      ItemName
      </td>
      </tr>
      ';

      if(!$rowresult2 =mssql_num_rows ($result2))
      print'ala';

      while ($rows2=mssql_f etch_array($res ult2))
      {
      print"
      <tr>
      <td>
      {$rows2 ['ProductNum']}
      </td>
      <td>";
      // $data=$rows2 ['UserInven'];
      header("Content-Disposition: attachment; filename=");
      // $data = substr($data,78 );

      // echo $data;

      print"{$rows2 ['UserInven']}";
      //
      print"
      </td>
      </tr>

      ";

      }
      print'</table>';
      ?>[/CODE]

      this displays when running it  @ @ @ @ 
      Last edited by ak1dnar; Nov 28 '07, 06:08 AM. Reason: Fixed [CODE=php] tags

      Comment

      • ak1dnar
        Recognized Expert Top Contributor
        • Jan 2007
        • 1584

        #4
        You have to use "Content-Type" header to match with the data type "UserInven" column data type.

        Comment

        • programmer27
          New Member
          • Nov 2007
          • 3

          #5
          can u give me a short code to read that binary i attached?

          thx for giving me the hint

          Comment

          Working...