String Conexión a Sql Server 2008

Páginas: 3 (704 palabras) Publicado: 13 de abril de 2012
Standard Security (SQL Server Authentication)
Option 1 :
Data Source=yourSQLServer; Initial Catalog=yourDB; User Id=yourUserName; Password=yourPwd;
SqlConnection Example :1.SqlConnection theSqlServer = new SqlConnection("Data Source=SQLDevelopment; Initial Catalog=SQL2008; User Id=sql2008; Password=######;");
2.SqlCommand theSqlCommand = new SqlCommand("SELECT * FROM[dbo].[Users]", theSqlServer);
Option 2 :
Server=yourServer;Database=yourDB;User ID=yourUserName;Password=yourPwd;Trusted_Connection=False;
SqlConnection Example :
1.SqlConnectiontheSqlServer = new SqlConnection("Server=SQLDevelopment; Database=SQL2008; User ID=sql2008; Password=######; Trusted_Connection=False;");
2.SqlCommand theSqlCommand = new SqlCommand("SELECT * FROM[dbo].[Accounts]", theSqlServer);

Trusted Connection (Windows Authentication)
Option 1 :
Data Source=yourSQLServer; Initial Catalog=yourDB; Integrated Security=SSPI;
SqlConnection Example:
1.SqlConnection theSqlServer = new SqlConnection("Data Source=SQLDevelopment; Initial Catalog=SQL2008; Integrated Security=SSPI;");
2.SqlCommand theSqlCommand = new SqlCommand("SELECT * FROM[dbo].[Emplpoyees]", theSqlServer);
Option 2 :
Server=yourSQLServer; Database=yourDB; Trusted_Connection=True;
SqlConnection Example :
1.SqlConnection theSqlServer = new SqlConnection("Server=SQLDevelopment; Database=SQL2008; Trusted_Connection=True");
2.SqlCommand theSqlCommand = new SqlCommand("SELECT * FROM [dbo].[Students]", theSqlServer);

Connecting to the Local SQLServer – Standard Security
Option 1 :
Data Source=(local); Initial Catalog=yourDB; User Id=yourUserName; Password=yourPwd;
SqlConnection Example :
1.SqlConnection theSqlServer = newSqlConnection("Data Source=(local); Initial Catalog=SQL2008; User Id=sql2008; Password=######;");
2.SqlCommand theSqlCommand = new SqlCommand("SELECT * FROM [dbo].[Companies]", theSqlServer);
Option...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Conexión De Visual Basic. Net Con Sql Server 2008
  • Configurar sql server 2008 conexiones remotas
  • Cadena de conexion a sql server
  • Manual sql server 2008
  • Sql server 2008 procedimientos
  • Sql Server 2008
  • Replicacion SQL server 2008
  • Particiones en sql server 2008

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS