-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Sudha0829
Message 4 in Discussion

Hi  Dheeraj
 
 
for connection in web.config file--- Code


<configuration>

<appSettings>

<add key="SQLServerConnectionString" value=" Server=Galaxe10; Database=THANKYOUNOTE; 
Uid=sa; pwd=Admin "/>

</appSettings>

<system.web>

''''''''''''''''''''''''''''

 In module level-- u write the code as below

''''''''''''''''''''''''''''

Public conString As String = 
ConfigurationSettings.AppSettings("SQLServerConnectionString")

Public conn As SqlConnection = New SqlConnection(conString)

Dim arrConnection() As String = Split(conString, ";")

Public Servernam As String = Trim(Mid(arrConnection(0), InStr(arrConnection(0), "=") + 
1))

Public databasenam As String = Trim(Mid(arrConnection(1), InStr(arrConnection(1), "=") 
+ 1))

Public UserID As String = Trim(Mid(arrConnection(2), InStr(arrConnection(2), "=") + 1))

Public Password As String = Trim(Mid(arrConnection(3), InStr(arrConnection(3), "=") + 
1))

You try with that code it will work. u can access servername , 
username,password,database name in entire application.

Bye

Sudha Reddy

 

 


DheerajKReddy <[EMAIL PROTECTED]> wrote:





New Message on BDOTNET



How to get Windows user name in Sql Server





Reply





 
Reply to Sender   Recommend 
Message 1 in Discussion 





From: DheerajKReddy 


Hi, 
I am working on a VB.NET application. Database is SQL Server 2000. I have a
table where one of the column's default value should be the windows login
user name. This table is populated via a trigger when a delete happens in
the related table. i.e basically I am logging all the "Deletes" into another
table with details like who deleted them and when was it deleted.
In the web.config my setting is 
<add key="CONNECTION_STRING" value="Server=localhost;Database=dat;UId=us;
Password=pt; pooling=false" /> 

If I use SUSER_SNAME(), I am getting the value "us" - the database user. But
I want the Windows Login Name. 
How will I get this? Please help

Regards
Dheeraj

View other groups in this category. 



                Do you Yahoo!?

Vote for the stars of Yahoo!'s next ad campaign!

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to