Sample for using kbmMemTable?

Hi experts,

I am currently on a project (using Delphi 6 + ADO + MS SQL Stored procedure), and was suggested to use KbmMemTable.

I have the help file for KbmMemTable, but couldn't find the setup step for KbmMemTable to talk to MS SQL.

Question:

1. Can someone give a simple example of using kbmMemTable, especially the setup step of talking to MS SQL server?

2. Do I still need to use ADO Connection, or other ADO components?


Thanks in advance
ourselvesAsked:
Who is Participating?
 
kretzschmarConnect With a Mentor Commented:
hi,

had done a look to the site,
and i guess this component is a simple memory dataset,
which provides a load and save method for the content as
an properitary binary format or as csv-format.

so to 1.
kbmMemTable cannot directly talk to any database,
you must load and save the content over an ado- or bde-
data-access component.

so to 2.
yes, see 1.

meikl ;-)
0
 
kretzschmarCommented:
read article
http://groups.yahoo.com/group/memtable/message/4351

for a sample

meikl ;-)
0
 
kretzschmarCommented:
hehe,
this article was initiated by yourself :-))
0
[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

 
aubsCommented:
I'm not quite sure what you are trying to achieve or why it has been suggested that you use kbm, but you might find it useful (if you have delphi 6), to look in the help/demos for Indy.

look in the TCPDataset directory for an example

0
 
ourselvesAuthor Commented:
To kretzschmar:
Thanks for answering my last Q (dbGrid drag&drop) as well. Yes, I have also put a msg on yahoo-memtable group.

To aubs:
I am new to Delphi, actually still doing ASP, and tend to use ADO+SQL stored procedure. The current module is almost finished, but I was told that if the application keeps on hitting the server database, it would create extra overhead. My previous experience tells me that stored procedure works quite OK, as it has already been compiled and optimized, especially talking about small dataset.

I am still not quite sure which way is better: stored procedure or memory table. Anyone has experience in using kbmMemTable?

Cheers!
0
 
kretzschmarCommented:
what is your goal?
what will you do?
0
 
ourselvesAuthor Commented:
kretzschmar,

Currently, my Delphi application calls up a stored procedure(MS SQL 7.0) for data manipulation. But an external consultant suggests that hitting the DB server constantly will create overhead, and slow down running. He wants to cache data (the selected dataset) on the client side, and do a batch processing. And he believes the kbmMemTable is the right component to cache data to the client side.

However the third party component developer doesn't give much explanation of using it. That's why I am looking for some help from experts here.

I remember MS has a RDS (remote data service) which also does the same thing (caching data on client side). Am I correct?

Thank you
0
 
aubsCommented:
OK, try this as a simple example to get you going:

Start a new app.

Drop a TTable, TDatasourse, TDBGrid and a kbmMemoryTable on the form.

Set the Grid datasource to Datasource1and set the Datasource dataset to kbmMemTable1.

Set the TTable Database to DBDEMOS and the tablename to biolife.db

Add 2 buttons.

Add this code to each of the buttons:

procedure TForm1.Button1Click(Sender: TObject);
begin //save data
  kbmMemTable1.Close;
  with kbmMemTable1 do
  begin
    Close;
    LoadFromDataSet(Table1, [mtcpoStructure, mtcpoOnlyActiveFields, mtcpoProperties, mtcpoLookup, mtcpoCalculated]);
    active := true;
    Open;
    SaveToFile('biolife.cds',  [mtfSaveData, mtfSaveCalculated, mtfSaveLookup, mtfSaveNonVisible, mtfSaveBlobs, mtfSaveDef, mtfSaveIndexDef, mtfSkipRest, mtfSaveFiltered, mtfSaveInLocalFormat]);
    active := false;
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin //load data
  with kbmMemTable1 do
  begin
    Close;
    active := true;
    LoadFromFile('biolife.cds');
    Open;
  end;
end;


Clicking on button1 will save the contents of table1 (biolife) to a local file called biolife.cds  (cds - client dataset).

Clicking on button2 loads biolife.cds into the kbmmemorytable and displays the data in the grid.
It is now possible to access this data using standard dataset commands: Next, Prior, FieldByName, etc


This is only an example of using the memory table locally.

I have used the component on the server side and then streamed the dataset to a kbmmemorytable component on the client side. If you need code for this sort of thing let me know. It is very similar to that above.

Aubs
0
 
ourselvesAuthor Commented:
aubs,

I was about to assign points for you and kretzschmar, but I don't know why it only gave the point to kretzschmar. Could you please go and have a look at

http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=delphi&qid=20313906

to collect your point

Cheers
0
All Courses

From novice to tech pro — start learning today.