November 18, 2010 at 2:34 am
Hello,
I have to add a custom parameter to the connection string (i cannot re-use other attributes like workstation id). Making some tests everything looks ok, for example:
Provider=SQLOLEDB;Data Source=myServer; Integrated Security=SSPI; Initial Catalog=myDatabase; NewAttribute='TestAttributeValue'
works fine (is not triggering errors when i connect to the server). But i don't know how can i access it in t-sql. Can you please help me? Is it possible to do something like this?
Thank you
November 18, 2010 at 2:48 am
via tsql, those custom attributes are not exposed, i think.
the application name and the host name are...if you do not provide it explicitly, the driver populates it for you automatically, so you can get them like this:
/*--results
(No column name)(No column name)
STORMDEVMicrosoft SQL Server Management Studio
*/
select host_name(), app_name()
if you provide the appname or host name, you override that functionality, like this:
Private Const SqlConnectionFormat As String = "data source={0};
initial catalog={1};
user id={2};
password={3};
Trusted_Connection=False;
Workstation ID=Ghost In The Machine;
Application Name=HaxxorPadPlusPlus;"
Lowell
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply