About SQLDMO 2005-4-5 16: 13: 52LW549
SqldMo.dll is a COM. After installing SQL Server, you are located under the Program Files / Binn folder. About SQLDMO what can do, is not the focus of this article, here only explains how to use this COM, now Start. The first step is to import SQLDMO, generate a type description file. Open Delphi, Project Menu -> Import Type Library ..., found "Microsoft SqldMo Object Library" (your version may be different from me), you can see the Class Names list box display Out of the corresponding class, because many class names are conflict with the VCL itself (such as Tapplication, TTable, etc.), you need to modify the name of the class, but it doesn't matter if you don't change. Here you have not changed, click the button "create unit", enter the long Waiting process. Since the generated file is relatively large (60,000 lines of code, 2.46M), this process is easily missed to crash, wait a moment. Step 2, modify the Type library file. After a long wait, I finally got a bad SQLDMO_TLB.PAS, however, when we compile, it found that this unit could not compile, prompted to repeat the ID, this simple, change the second ID to XID, compile by. The third step is used. During use, I found that in many cases, the classes in SqldMo_TLB.PAS are unused, AV errors appear. For example, RESTORE, you must use this: CreateoleObject ('sqldmo.restore'); some events provided by Sqldmo, have a very good grammatical support in .NET and VB environments, the same problem, but it is abnormal in Delphi, we must not Do not maintain iConnectionPointContainer, do you have a simple way in the problem of a line of code in VB? There is also! And the same simple! The answer is EventsinkImp, you can go to http://www.techvanguards.com for free download. The installation is also very simple, all the way yes is OK. EventsinkImp is based on IconnectionPointContainer, or that it is very troublesome by EventsinkImp. Its usage interface is similar to Import Type Library, and there is not much to say it here. After IMPORT, you get two files for sqldmoevents.pas and sqldmo_tlb.pas. Compile passed, install error. Good things multi-grinding ^ - ^ According to the error prompt, you can find TTable, TDatabase to conflict with the existing classes in the system, change to TSQLTable and TsqLDatabase. Eventsinkim is very simple, depending on help, CONNECT can be successfully monitored before use. In the cells using sqldmoevents.pas and sqldmo_tlb.pas, if classes, such as Tapplication, remember to add cell names in front of the class, such as Forms.Application is OK.
Write down these hopes to learn from the later people, if there are other better ways, welcome, thank you!