System.Data.SqlClient Namespace SqlConnection Class
Returns a string that identifies the database client.
Script |
[ tring variable = ] SqlConnection.WorkstationId |
variable |
Returns a string that identifies the database client. If not specified, the name of the client computer. |
The property is read only with no default value.
NOTE: You can change the value for this property only by setting the corresponding Workstation ID keyword in the ConnectionString property.
Exception Type |
Condition |
InvalidOperationException |
Occurs when the connection is open ( you must first close the connection ), or the connection is broken. |
The string typically contains the network name of the client. The WorkstationId property corresponds to the Workstation ID connection string property.
NOTE: This property is read-only while the connection is open.
The following example shows the simplest way to retrieve and display the WorkstationId property of the current connection.
"Workstation Id: " + myConn.WorkstationId;
"Workstation Id: " + myConn.WorkstationId |
|
C# |
VB |
Show me
SqlConnection Members