VB/ASP数据库连接字符串示例
--------------------------------------------------------------------------------
使用DSN的数据库连接字符串例:
MS SQL / MySQL / PostgreSQL
"DSN=dsnname"
不使用DSN数据库连接字符串例:
MS Access
通过OLEDB:
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:somepathmyDb.mdb;"
MS SQL
通过ODBC:
"Driver={SQL Server}; Server=MyServerName; Database=myDatabaseName; UID=myUsername; PWD=myPassword"
With OLEDB (Recommended):
"Provider=sqloledb; Data Source=myServerName; Initial Catalog=myDatabaseName; User Id=myUsername; Password=myPassword"
MySQL
通过ODBC:
"Driver={MySQL ODBC 3.51 Driver}; Server=servername; Database=dbname; UID=username; PWD=password; Option=3"
PostgreSQL
通过ODBC:
"Driver={PostgreSQL}; Server=servername; Database=dbname; UID=username; PWD=password"
对于MS Access数据库来说,因为Access数据库的ODBC驱动程序会导致不稳定 ,所以最好不要通过DSN来连接。
版权声明:
作者:xiaoniba
链接:https://blog.xiaoniba.com/2006/09/22/vbasp%e6%95%b0%e6%8d%ae%e5%ba%93%e8%bf%9e%e6%8e%a5%e5%ad%97%e7%ac%a6%e4%b8%b2%e7%a4%ba%e4%be%8b/
来源:小泥吧的博客
文章版权归作者所有,未经允许请勿转载。
爱上_鱼
图好好 ,偶全部收藏喽 ,xixi