ODBC: Connecting to databases
The code is as follows |
Copy Code |
Driver={sql Server}; server=rousecms.hostedresource.com; Database=rousecms; Uid=rousecms; pwd= ' Your password '; |
OLE DB, OleDbConnection (. NET): Connecting to a database
The code is as follows |
Copy Code |
Provider=sqloledb; Data source=rousecms.hostedresource.com; Initial Catalog=rousecms; User Id=rousecms; Password= ' Your Password '; Provider=sqloledb; Server=meteor-pc;database=rousecms; Uid=sa; pwd=123456
|
SqlConnection (. NET):
The code is as follows |
Copy Code |
Data source=rousecms.hostedresource.com; Initial Catalog=rousecms; User Id=rousecms; Password= ' Your Password ';
|
Cases
Connecting in. Net
The code is as follows |
Copy Code |
System.Data System.Data.SqlClient public void Page_Load () { Sqlconnetion myconnetion=new sqlconnetion (); myconnetion.sqlconnetionstring= "User id=sa;password=***;initial catalog=testdatabase;data source=mySqlServer"; Myconnetion.open (); } |
Cases
code is as follows |
copy code |
connstr= " Data source= ' AAA '; uid=;p wd=;d atabase= ' sss ' Data source UID user name pwd password database name; 2, if it's Winnt Card mode connstr to add Trusted_connection=yes 3, remote connection and local connection, just modify data source |