Hi All,

 Please advise on how to access data buffer for
varbinary(2000) from SQL Server with reference to the
following code. The Pointer gets assigned, 
but how to retrive data from the pointer is not
apparent.

 Field ColWidths is varbinary(2000) is being used to
store the columns width of a grid. The values have to
be retrived from the field and assigned to Grid's
Columns width in order. Here I am attempting to store
an array(Column Widths) in database and retrive the
same as one record, this is easily achieved using
seprate record for each Column, but number of records
have to be minimised. Any valuable suggestions to do
the same are welcome.

procedure TForm1.ReadColumnsWidth;
var sWidth : string;
    MyBuffer : Pointer;
begin
    try
        try
          if not Assigned(TempQry) then
              TempQry:=TADOQuery.Create(NIL);
          with TempQry do
          begin
              Close;
              Connection:=ADOConnection;
              SQL.Clear;
              SQL.Add('Select
QueryName,IsClassified,ColWidths from 
TBL_Temp order by QueryID desc');
              Open;
              if not IsEmpty then
                with FieldByName('ColWidths') do
                begin
                  GetMem(MyBuffer, DataSize);
                  try
                    if not GetData(@MyBuffer) then
                       MessageDlg(DisplayName + ' is
NULL', 
mtInformation, [mbOK], 0)
                    else
                        
                       { How to access data in Buffer
};
                  finally
                    FreeMem(MyBuffer, DataSize);
                  end;
                 end;
               Close;
              {with SortGrid do
                for i:=0 to ColCount-1 do
                    ColWidths[i]:=sWidth; }
          end;
        except on E:Exception do
            showmessage(E.Message);
        end;
    finally
        FreeandNil(TempQry);
    end;
end;

Thanks & Regards,

Asim Khan



                
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 


------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12hugq8bp/M=362131.6882499.7825260.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1123063467/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life 
- brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~-> 

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to