Solved

Sample for using kbmMemTable?

Posted on 2002-06-12
9
4,112 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

770 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