SQLNS in C#

  • Thread starter Thread starter Guest
  • Start date Start date
Well it worked, thanks! But I'm not exactly sure how I did it yet! ;~)

Here's the code to, in C#, open the properties window for Northwind db
***************************
SQLNamespace oSQLNS = new SQLNamespace();
string s = "Server=localhost;UID=sa;PWD=<insert sa password here>;Trusted_Connection=Yes;Database=;";
object con = s;
oSQLNS.Initialize("Squelsh", SQLNS.SQLNSRootType.SQLNSRootType_Server, ref con, (Int32) 1);
Int32 i = 0;
i = oSQLNS.GetRootItem();
i = oSQLNS.GetFirstChildItem(i, SQLNS.SQLNSObjectType.SQLNSOBJECTTYPE_DATABASES, null);
i = oSQLNS.GetFirstChildItem(i, SQLNS.SQLNSObjectType.SQLNSOBJECTTYPE_DATABASE, "Northwind");
SQLNS.SQLNamespaceObject SQLnso = oSQLNS.GetSQLNamespaceObject(i);
SQLnso.ExecuteCommandByID(SQLNS.SQLNSCommandID.SQLNS_CmdID_PROPERTIES, (Int32) 0, SQLNS.SQLNSModality.SQLNamespace_PreferModal);
***************************

Cheers,
/Magnus - NoopMan ;~)
 
Well it worked, thanks! But I'm not exactly sure how I did it yet! ;~)

Here's the code to, in C#, open the properties window for Northwind db
***************************
SQLNamespace oSQLNS = new SQLNamespace();
string s = "Server=localhost;UID=sa;PWD=<insert sa password here>;Trusted_Connection=Yes;Database=;";
object con = s;
oSQLNS.Initialize("Squelsh", SQLNS.SQLNSRootType.SQLNSRootType_Server, ref con, (Int32) 1);
Int32 i = 0;
i = oSQLNS.GetRootItem();
i = oSQLNS.GetFirstChildItem(i, SQLNS.SQLNSObjectType.SQLNSOBJECTTYPE_DATABASES, null);
i = oSQLNS.GetFirstChildItem(i, SQLNS.SQLNSObjectType.SQLNSOBJECTTYPE_DATABASE, "Northwind");
SQLNS.SQLNamespaceObject SQLnso = oSQLNS.GetSQLNamespaceObject(i);
SQLnso.ExecuteCommandByID(SQLNS.SQLNSCommandID.SQLNS_CmdID_PROPERTIES, (Int32) 0, SQLNS.SQLNSModality.SQLNamespace_PreferModal);
***************************

Cheers,
/Magnus - NoopMan ;~)
 
Anyone feel like explaining the following:

1) The fourth parameter to SQLNamespace.Initialize?
2) Which premissions is it that give the sa right to access SQLNS.SQLNSRootType.SQLNSRootType_Server?
3) The second parameter to SQLNS.SQLNamespaceObject.ExecuteCommandByID?

Cheers,
 
Anyone feel like explaining the following:

1) The fourth parameter to SQLNamespace.Initialize?
2) Which premissions is it that give the sa right to access SQLNS.SQLNSRootType.SQLNSRootType_Server?
3) The second parameter to SQLNS.SQLNamespaceObject.ExecuteCommandByID?

Cheers,
 
Back
Top