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=190.190.200.100,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 ado.net 2.0 for mars functionality. mars is not supported in ado.net 1.0 nor ado.net 1.1
streamline your data connections by moving to mars, by laurence moroney, devx.com >>
attach a database file on connect to a local sql server express instance:
"server=./sqlexpress;attachdbfilename=c:/asd/qwe/mydbfile.mdf;database=dbname;trusted_connection=yes;"
- or -
"server=./sqlexpress;attachdbfilename=|datadirectory|mydbfile.mdf;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|/mydb.mdf;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 computer. to enable the functionality: sp_configure 'user instances enabled','1' (0 to disable)
using sql server 2005 express? don't miss the server name syntax: servername/sqlexpress (substitute "servername" with the name of the computer)
Qt鏈結資料庫與使用SQL
一直沒接觸資料庫,前一陣突然有機會用了用mysql,順手把sql語法學了一遍,學完了手癢癢,一想qt可以 結合資料庫,就順便試了下qt鏈結資料庫與使用sql sql部分就不說了 qt先說鏈結部分 1.先做資料庫驅動,現在qt sdk for windows裡面已經有odbc的驅動了,我當時現做了個m...
SQL資料庫鏈結C 的Application
對於向工程中新增資料庫和資料庫的鏈結條件語句,這邊就不多說了 鏈結語句是系統自動生成的,新增乙個string變數儲存即可 下面是關於主程式的 留作備用 using system using system.collections.generic using system.linq using syst...
資料庫鏈結
1 oracle8 8i 9i資料庫 thin模式 class.forname oracle.jdbc.driver.oracledriver newinstance string url jdbc oracle thin localhost 1521 orcl orcl為資料庫的sid strin...