16 April 2011

Connection String For dotnet framework Vb.net and C# Connectivity

Connection String For dotnet framework

Vb.net Connectivity

'VB
Dim connection as DbConnection = new SqlConnection()
connection.ConnectionString = _
"Server=.;Database=pubs;Trusted_Connection=true" connection.Open()

'Do lots of cool work here

connection.Close()

C# Connectivity

//C#

DbConnection connection = new SqlConnection();connection.ConnectionString =
"Server=.;Database=pubs;Trusted_Connection=true"; connection.Open();
//Do lots of cool work here connection.Close();


Creating an instance of the SqlConnection class using the SQL Server .NET provider creates
the DbConnection. The ConnectionString property is initialized to use the local machine (".")
and the database is set to pubs. Lastly, the connection uses a trusted connection for
authentication when connecting to SQL Server.

1 comment:

  1. Also Check this link

    http://msdn.microsoft.com/en-us/library/aa720188%28VS.71%29.aspx

    ReplyDelete

Comments Welcome

Consistency level in Azure cosmos db

 Consistency level in Azure cosmos db Azure Cosmos DB offers five well-defined consistency levels to provide developers with the flexibility...