Solved

Sample for using kbmMemTable?

Posted on 2002-06-12
9
4,174 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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
 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Internet Explorer View Settings Question 15 116
LAN or WAN ? 11 95
Graphics32 under Delphi 10.1 Berlin 2 98
Firemonkey allowing RTL on android 6 46
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

808 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