Solved

Sample for using kbmMemTable?

Posted on 2002-06-12
9
3,979 Views
Last Modified: 2007-11-27
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
0
Comment
Question by:ourselves
  • 4
  • 3
  • 2
9 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 7074739
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7074741
read article
http://groups.yahoo.com/group/memtable/message/4351

for a sample

meikl ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7074754
hehe,
this article was initiated by yourself :-))
0
 
LVL 2

Expert Comment

by:aubs
ID: 7075672
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:ourselves
ID: 7076696
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7077370
what is your goal?
what will you do?
0
 

Author Comment

by:ourselves
ID: 7082203
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
 
LVL 2

Expert Comment

by:aubs
ID: 7083261
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
 

Author Comment

by:ourselves
ID: 7093826
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

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now