Asp tutorial. net connection mssql mysql tutorial access excel 2007 database tutorial
This article has added an asp.net tutorial to connect to the mssql mysql access excel 2007 database. The following is a good classification. Just copy it and change the connection file address to your address.
Mssql
Asp.net connection
"Server = db server; database = db name; uid = db id; pwd = db password;" providername = "system. data. sqlclient" ole db connection string (dsnless connection ):
"Provider = sqloledb; data source = db server; user id = db id; password = db password; initial catalog = db name ;"
Odbc connection string
"Dsn = odbc name; user id = db id; password = db password; initial catalog = db name ;"
Pleasereplace is in red to your database information. If youdon't knows the database information, you can see this article.
For example:
Odbc name: the name of the odbc you created is in the Control Panel> "database"> odbc
Database server: sql3xx.mysite4now.com
Db name: mydemodb_12345
Database id: mydemoid_12345
Database password: mydemopw
Mysql
Ole db connection string (dsnless connection ):
"Driver = {mysql}; server = db server; database = db name; user = db id; password = db password; option = 3 ;"
Odbc connection string (requires a odbc to be created first ):
"Dsn = odbc name; user = db id; password = db password; database = db name ;"
Pleasereplace is in red to your database information.
For example:
Odbc name: the name of the odbc you created is in the Control Panel> "database"> odbc
IP address: mysqlxxx.mysite4now.com
Db name: mysqldemo_12345
Database id: mysqldemo_12345
Database password: mysqlpw
Excel
"Provider = microsoft. jet. oledb.4.0; data source = path of excel; extended properties = excel 8.0 & prime;
Replace your database connection file
Example: d: www.111cn.netmembermemberidmyexcel.xls
Pstutorial. if you need to write data into your excel database, please grant write permission to the excel file.
Excel 2007
"Provider = microsoft. ace. oledb.12.0; data source = path of excel; extended properties = excel 12.0 & prime;
Replace your data connection address
Example: d: hostingmemberwww.111cn.netmyexcel2007.xlsx
If you want to write data to an excel database, grant the write permission to an excel file.
Access
For access db without password protection:
"Provider = microsoft. jet. oledb.4.0; data source = path of access db"
For access db with password protection:
"Provider = msdasql; driver = {microsoft access driver (*. mdb)}; dbq = path of access db; password = password of db"
Replace your database connection address
Example: d: hostinghttp: // mb.111cn. netmemberidmyaccessdb. mdb