【正文】
puter name The name of the workstation connecting to SQL Server. Note Use 。 to separate each property.If a name occurs more than once, the value from the last one in the connection string will be used.If you are building your connection string in your app using values from user input fields, make sure the user can39。t change the connection string by inserting an additional property with another value within the user value. SQL Server 2005 SQL Native Client ODBC Driver Standard security:Driver={SQL Native Client}。Server=Aron1。Database=pubs。UID=sa。PWD=asdasd。 Trusted connection:Driver={SQL Native Client}。Server=Aron1。Database=pubs。Trusted_Connection=yes。 EquivalentsIntegrated Security=SSPI equals Trusted_Connection=yes Prompt for username and password:(Prompt) = adPromptAlways Driver={SQL Native Client}。Server=Aron1。DataBase=pubs。 Enabling MARS (multiple active result sets):Driver={SQL Native Client}。Server=Aron1。Database=pubs。Trusted_Connection=yes。MARS_Connection=yes EquivalentsMultipleActiveResultSets=true equals MARS_Connection=yesUsing MARS with SQL Native Client, by Chris Lee Encrypt data sent over network:Driver={SQL Native Client}。Server=Aron1。Database=pubs。Trusted_Connection=yes。Encrypt=yes Attach a database file on connect to a local SQL Server Express instance:Driver={SQL Native Client}。Server=.\SQLExpress。AttachDbFilename=c:\asd\qwe\。Database=dbname。Trusted_Connection=Yes。 or Driver={SQL Native Client}。Server=.\SQLExpress。AttachDbFilename=|DataDirectory|。Database=dbname。Trusted_Connection=Yes。 (use |DataDirectory| when your database file resides in the data directory)Why is the Database parameter needed? Answer: If the database was previously attached, SQL Server does not reattach it (it uses the attached database as the default for the connection).Download the SQL Native Client here (the package contains booth the ODBC driver and the OLE DB provider)Using SQL Server 2005 Express? Don39。t miss the server name syntax: SERVERNAME\SQLEXPRESS (Substitute SERVERNAME with the name of the puter) SQL Native Client OLE DB Provider Standard security:Provider=SQLNCLI。Server=Aron1。Database=pubs。UID=sa。PWD=asdasd。 Trusted connection:Provider=SQLNCLI。Server=Aron1。Database=pubs。Trusted_Connection=yes。 EquivalentsIntegrated Security=SSPI equals Trusted_Connection=yes Prompt for username and password:(Prompt) = adPromptAlways Provider=SQLNCLI。Server=Aron1。DataBase=pubs。 Enabling MARS (multiple active result sets):Provider=SQLNCLI。Server=Aron1。Database=pubs。Trusted_Connection=yes。MarsConn=yes EquivalentsMarsConn=yes equals MultipleActiveResultSets=true equals MARS_Connection=yesUsing MARS with SQL Native Client, by Chris Lee Encrypt data sent over network:Provider=SQLNCLI。Server=Aron1。Database=pubs。Trusted_Connection=yes。Encrypt=yes Attach a database file on connect to a local SQL Server Express instance:Provider=SQLNCLI。Server=.\SQLExpress。AttachDbFilename=c:\asd\qwe\。Database=dbname。Trusted_Connection=Yes。 or Provider=SQLNCLI。Server=.\SQLExpress。AttachDbFilename=|DataDirectory|。Database=dbname。Trusted_Connection=Yes。 (use |DataDirectory| when your database file resides in the data directory)Why is the Database parameter needed? Answer: If the database was previously attached, SQL Server does not reattach it (it uses the attached database as the default for the connection).Download the SQL Native Client here (the package contains booth the ODBC driver and the OLE DB provider)Using SQL Server 2005 Express? Don39。t miss the server name syntax: SERVERNAME\SQLEXPRESS (Substitute SERVERNAME with the name of the puter) SqlConnection (.NET) Standard Security:Data Source=Aron1。Initial Catalog=pubs。User Id=sa。Password=asdasd。 or Server=Aron1。Database=pubs。User ID=sa。Password=asdasd。Trusted_Connection=False (both connection strings produces the same result) Trusted Connection:Data Source=Aron1。Initial Catalog=pubs。Integrated Security=SSPI。 or Server=Aron1。Database=pubs。Trusted_Connection=True。 (both connection strings produces the same result)(use serverName\instanceName as Data Source to use an specifik SQLServer instance) Connect via an IP address:Data Source=,1433。Network Library=DBMSSOCN。Initial Catalog=pubs。User ID=sa。Password=asdasd。 (DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default)) Enabling MARS (multiple active result sets):Server=Aron1。Database=pubs。Trusted_Connection=True。MultipleActiveResultSets=true Note! Use for MARS functionality. MARS is not supported in nor Streamline your Data Connections by Moving to MARS, by Laurence Moroney, Attach a database file on connect to a local SQL Server Express instance:Server=.\SQLExpress。AttachDbFilename=c:\asd\qwe\。Database=dbname。Database=dbname。Trusted_Connection=Yes。 or Server=.\SQLExpress。AttachDbFilename=|DataDirectory|。Database=dbname。Trusted_Connection=Yes。 (use |DataDirectory| when your database file resides in the data directory) Why is the Database parameter needed? Answer: If the database was previously attached, SQL Server does not reattach it (it uses the attached database as the default for the connection). Using User Instance on a local SQL Server Express instance:Data Source=.\SQLExpress。integrated security=true。attachdbfilename=|DataDirectory|\。user instance=true。 The User Instance functionality creates a new SQL Server instance on the fly during connect. This works only on a local SQL Server 2005 instance and only when connecting using windows authentication over local named pipes. The purpose is to be able to create a full rights SQL Server instance to a user with limited administrative rights on the puter. To