4个回答
展开全部
你好一共有这几种
MS
Access数据库连接
用DSN连接并且没有用户名和密码:
<%
set
conn
=
Server.CreateObject("ADODB.Connection")
conn.open
"YourDSNName"
%>
用DSN连接并且有用户名和密码:
<%
set
conn
=
Server.CreateObject("ADODB.Connection")
conn.open
"YourDSNName","username","password"
%>
用实际的数据库绝对路径连接:
<%
Set
conn
=
Server.CreateObject("ADODB.Connection")
Strconn="DRIVER={Microsoft
Access
Driver
(*.mdb)};
"
Strconn=Strconn
&
"DBQ=e:\yanhang\database.mdb"
conn.Open
Strconn
%>
用实际的数据库相对路径连接:
<%
Set
conn
=
Server.CreateObject("ADODB.Connection")
Strconn="DRIVER={Microsoft
Access
Driver
(*.mdb)};
"
Strconn=Strconn
&
"DBQ="
&
Server.MapPath("/database/yanhang.mdb")
conn.Open
Strconn
%>
MS
SQL
Server数据库连接
用DSN连接:
<%
set
conn
=
Server.CreateObject("ADODB.Connection")
conn.open
"DSN=MyDSN;UID=user;PWD=password;DATABASE=databasename"
%>
不用DSN连接:
<%
Set
conn
=
Server.CreateObject("ADODB.Connection")
DSNtemp="DRIVER={SQL
Server};SERVER=ServerName;UID=USER;PWD=password;DATABASE=databasename"
conn.open
DSNtemp
%>
FoxPro数据库连接
<%
Set
Conn
=
Server.CreateObject("ADODB.connection")
ConnStr=
"Driver=Microsoft
Visual
Foxpro
Driver;
UID=userID;SourceType=DBC;SourceDB=C:\yanhang\database.dbc"
Conn.Open
ConnStr
%>
Oracle数据库连接:
<%
set
conn=server.createobject("adodb.connection")
conn.cursorlocation=adUseClient
DSNTemp="Provider=MSDAORA.1;Password=xxxxx;User
ID=yanhang;Data
Source=xxx.world"
conn.open
DSNtemp
%>
MS
Access数据库连接
用DSN连接并且没有用户名和密码:
<%
set
conn
=
Server.CreateObject("ADODB.Connection")
conn.open
"YourDSNName"
%>
用DSN连接并且有用户名和密码:
<%
set
conn
=
Server.CreateObject("ADODB.Connection")
conn.open
"YourDSNName","username","password"
%>
用实际的数据库绝对路径连接:
<%
Set
conn
=
Server.CreateObject("ADODB.Connection")
Strconn="DRIVER={Microsoft
Access
Driver
(*.mdb)};
"
Strconn=Strconn
&
"DBQ=e:\yanhang\database.mdb"
conn.Open
Strconn
%>
用实际的数据库相对路径连接:
<%
Set
conn
=
Server.CreateObject("ADODB.Connection")
Strconn="DRIVER={Microsoft
Access
Driver
(*.mdb)};
"
Strconn=Strconn
&
"DBQ="
&
Server.MapPath("/database/yanhang.mdb")
conn.Open
Strconn
%>
MS
SQL
Server数据库连接
用DSN连接:
<%
set
conn
=
Server.CreateObject("ADODB.Connection")
conn.open
"DSN=MyDSN;UID=user;PWD=password;DATABASE=databasename"
%>
不用DSN连接:
<%
Set
conn
=
Server.CreateObject("ADODB.Connection")
DSNtemp="DRIVER={SQL
Server};SERVER=ServerName;UID=USER;PWD=password;DATABASE=databasename"
conn.open
DSNtemp
%>
FoxPro数据库连接
<%
Set
Conn
=
Server.CreateObject("ADODB.connection")
ConnStr=
"Driver=Microsoft
Visual
Foxpro
Driver;
UID=userID;SourceType=DBC;SourceDB=C:\yanhang\database.dbc"
Conn.Open
ConnStr
%>
Oracle数据库连接:
<%
set
conn=server.createobject("adodb.connection")
conn.cursorlocation=adUseClient
DSNTemp="Provider=MSDAORA.1;Password=xxxxx;User
ID=yanhang;Data
Source=xxx.world"
conn.open
DSNtemp
%>
展开全部
你好一共有这几种
MS Access数据库连接
用DSN连接并且没有用户名和密码:
<%
set conn = Server.CreateObject("ADODB.Connection")
conn.open "YourDSNName"
%>
用DSN连接并且有用户名和密码:
<%
set conn = Server.CreateObject("ADODB.Connection")
conn.open "YourDSNName","username","password"
%>
用实际的数据库绝对路径连接:
<%
Set conn = Server.CreateObject("ADODB.Connection")
Strconn="DRIVER={Microsoft Access Driver (*.mdb)}; "
Strconn=Strconn & "DBQ=e:\yanhang\database.mdb"
conn.Open Strconn
%>
用实际的数据库相对路径连接:
<%
Set conn = Server.CreateObject("ADODB.Connection")
Strconn="DRIVER={Microsoft Access Driver (*.mdb)}; "
Strconn=Strconn & "DBQ=" & Server.MapPath("/database/yanhang.mdb")
conn.Open Strconn
%>
MS SQL Server数据库连接
用DSN连接:
<%
set conn = Server.CreateObject("ADODB.Connection")
conn.open "DSN=MyDSN;UID=user;PWD=password;DATABASE=databasename"
%>
不用DSN连接:
<%
Set conn = Server.CreateObject("ADODB.Connection")
DSNtemp="DRIVER={SQL Server};SERVER=ServerName;UID=USER;PWD=password;DATABASE=databasename"
conn.open DSNtemp
%>
FoxPro数据库连接
<%
Set Conn = Server.CreateObject("ADODB.connection")
ConnStr= "Driver=Microsoft Visual Foxpro Driver; UID=userID;SourceType=DBC;SourceDB=C:\yanhang\database.dbc"
Conn.Open ConnStr
%>
Oracle数据库连接:
<%
set conn=server.createobject("adodb.connection")
conn.cursorlocation=adUseClient
DSNTemp="Provider=MSDAORA.1;Password=xxxxx;User ID=yanhang;Data Source=xxx.world"
conn.open DSNtemp
%>
MS Access数据库连接
用DSN连接并且没有用户名和密码:
<%
set conn = Server.CreateObject("ADODB.Connection")
conn.open "YourDSNName"
%>
用DSN连接并且有用户名和密码:
<%
set conn = Server.CreateObject("ADODB.Connection")
conn.open "YourDSNName","username","password"
%>
用实际的数据库绝对路径连接:
<%
Set conn = Server.CreateObject("ADODB.Connection")
Strconn="DRIVER={Microsoft Access Driver (*.mdb)}; "
Strconn=Strconn & "DBQ=e:\yanhang\database.mdb"
conn.Open Strconn
%>
用实际的数据库相对路径连接:
<%
Set conn = Server.CreateObject("ADODB.Connection")
Strconn="DRIVER={Microsoft Access Driver (*.mdb)}; "
Strconn=Strconn & "DBQ=" & Server.MapPath("/database/yanhang.mdb")
conn.Open Strconn
%>
MS SQL Server数据库连接
用DSN连接:
<%
set conn = Server.CreateObject("ADODB.Connection")
conn.open "DSN=MyDSN;UID=user;PWD=password;DATABASE=databasename"
%>
不用DSN连接:
<%
Set conn = Server.CreateObject("ADODB.Connection")
DSNtemp="DRIVER={SQL Server};SERVER=ServerName;UID=USER;PWD=password;DATABASE=databasename"
conn.open DSNtemp
%>
FoxPro数据库连接
<%
Set Conn = Server.CreateObject("ADODB.connection")
ConnStr= "Driver=Microsoft Visual Foxpro Driver; UID=userID;SourceType=DBC;SourceDB=C:\yanhang\database.dbc"
Conn.Open ConnStr
%>
Oracle数据库连接:
<%
set conn=server.createobject("adodb.connection")
conn.cursorlocation=adUseClient
DSNTemp="Provider=MSDAORA.1;Password=xxxxx;User ID=yanhang;Data Source=xxx.world"
conn.open DSNtemp
%>
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2015-04-22 · 知道合伙人软件行家
关注
展开全部
1. mysql:
mysql -h 数据库地址 -u root -p 密码;
2.oracle:
sqlplus sys/password as sysdba 这个是作为管理员登陆
sqlplus username/password 这个是普通账户登录
3.sqlserver
sqlcmd.exe
mysql -h 数据库地址 -u root -p 密码;
2.oracle:
sqlplus sys/password as sysdba 这个是作为管理员登陆
sqlplus username/password 这个是普通账户登录
3.sqlserver
sqlcmd.exe
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2014-05-30
展开全部
use 数据库名
数据库必须已经创建
数据库必须已经创建
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询