解析用ADO连接各种数据库的代码(3)_ASP教程
教程Tag:暂无Tag,欢迎添加,赚取U币!
推荐:如何用Split将字符串转换为数组并获取数组下标值将数据使用间隔字符串存储可以减少少写几个数据库字段,也方便以后对扩展数据。 比如:在论坛中用户的性格有多重性格、乐天达观、成熟稳重、幼稚调皮、温柔体贴等等,他们分别对应的值为0、1、2、3、4,在存储这些数据时使用间隔字符串,将数据存储到一个文本
oConn.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\somepath\mydb.mdb;" & _
"Jet OLEDB:Database Password=MyDbPassword;", _
"admin", ""
c)OLE DB Provider for Excel Spreadsheet:
oConn.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\somepath\expenses.xls;" & _
"Extended Properties=""Excel 8.0;HDR=Yes;"";"
注意: "HDR=Yes"表示在第一行中是行标题,在provider中将不把第一行包括入recordset中
d)OLE DB Provider for SQL Server
i)普通安全模式:
oConn.Open "Provider=sqloledb;" & _
"Network Library=DBMSSOCN;" & _
"Data Source=carl2;" & _
"Initial Catalog=pubs;" & _
"User Id=sa;" & _
"Password=;"
ii)使用信任安全模式:
oConn.Open "Provider=sqloledb;" & _
Network Library=DBMSSOCN;" & _
"Data Source=carl2;" & _
"Initial Catalog=pubs;" & _
"Trusted_Connection=yes;"
注意:"Network Library=DBMSSOCN"声明OLE DB使用TCP/IP替代Named Pipes.
e)OLE DB Provider for Oracle
oConn.Open "Provider=msdaora;" & _
"Data Source=OracleServer.world;" & _
"User Id=sa;" & _
"Password=;"
(VI)Remote OLE DB Provider Connections方式(就是我一直在研究的RDS方式哦,呵呵。):
a)MS Remote - Access (Jet)
i)ODBC DSN:
oConn.Open "Remote Server=http://carl2;" & _
"Remote Provider=MSDASQL;" & _
"DSN=AdvWorks;" & _
"Uid=admin" & _
"Pwd=;"
ii)OLE DB Provider:
oConn.Open "Provider=MS Remote;" & _
"Remote Server=http://carl2;" & _
"Remote Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\somepath\mydb.mdb;", _
"admin", ""
iii)OLE DB Provider自定义事务对象
oConn.Open "Provider=MS Remote;" & _
"Remote Server=http://carl2;" & _
"Handler=MSDFMAP.Handler;" & _
"Data Source=MyAdvworksOLEDBConnectTag;"
b)MS Remote - SQL Server
i)ODBC DSN:
oConn.Open "Remote Server=http://carl2;" & _
"Remote Provider=MSDASQL;" & _
"Network Library=DBMSSOCN;" & _
"DSN=Pubs;" & _
"Uid=sa" & _
"Pwd=;"
ii)OLE DB Provider
oConn.Open "Provider=MS Remote;" & _
"Remote Server=http://carl2;" & _
"Remote Provider=SQLOLEDB;" & _
"Network Library=DBMSSOCN;" & _
"Data Source=carl2;" & _
"Initial Catalog=pubs;" & _
"User ID=sa;" & _
"Password=;"
分享:Asp生成13位随机字符串html title /title body % Functiongen_key(digits) ’定义并初始化数组 dimchar_array(80) ’初始化数字 Fori=0To9 char_array(i)=CStr(i) Next ’初始化大写字母 Fori=10To35 char_array(i)=Chr(i+55) Next ’初始化小写字母 Fori=36To61 char_array(i)=Chr
相关ASP教程:
- 相关链接:
- 教程说明:
ASP教程-解析用ADO连接各种数据库的代码(3)。