Solved

Sample for using kbmMemTable?

Posted on 2002-06-12
9
4,379 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

707 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