Create | scripts | data | database
SQLDMO (SQL distributed Management objects,sql Distributed Management Objects) encapsulates objects in a Microsoft SQL Server database. SQLDMO is the application interface used by Enterprise Manager in Microsoft SQL Server.
SQLDMO is provided by Microsoft SQL Server's SQLDMO.dll, and since SQLDMO.dll is a COM object, you must add a reference to it in the. NET project before you use it.
SQLDMO. SQL Server oserver = new SQLDMO. SQL Server ();
Oserver.connect ("127.0.0.1", "sa", "Sapassword");
Sqldmo._database mydb = OServer.Databases.Item ("Northwind", "owner");
Sqldmo._table myTable = MyDB. Tables.item ("Categories", "dbo");
string s = Mytable.script (SQLDMO. Sqldmo_script_type. Sqldmoscript_default,null,null, SQLDMO. Sqldmo_script2_type. Sqldmoscript2_default);
Oserver.disconnect ();
Source.text = s;