如何在asp程序中把用ODBC连接的程序转换成ADO连接的?急!急!急!急!急!急!(100分回报)~~~~~~~ ( 积分: 100 )

  • 主题发起人 主题发起人 Mary_Mary_2005
  • 开始时间 开始时间
M

Mary_Mary_2005

Unregistered / Unconfirmed
GUEST, unregistred user!
高手们好!:)
小女子在这里有礼了。!:)我的asp的作业明天就要交了。555555555555555我只会用odbc连接数据库在asp中,可是老师一定要让ado连接。我已经做好了一个asp的odbc连接数据库的程序。哪位高手能帮帮小女子呢?谢谢了。有意者请加我的QQ详谈,谢谢。(QQ:398697872)
本人在线等待高手。:)
 
高手们好!:)
小女子在这里有礼了。!:)我的asp的作业明天就要交了。555555555555555我只会用odbc连接数据库在asp中,可是老师一定要让ado连接。我已经做好了一个asp的odbc连接数据库的程序。哪位高手能帮帮小女子呢?谢谢了。有意者请加我的QQ详谈,谢谢。(QQ:398697872)
本人在线等待高手。:)
 
把连接串写出来,很容易改的,只要放ADODB.Connection的那个串就可以了
参考
http://www.topying.com/showfine.asp?id=59
----------------------
首先当然是SQL server 了,现在SQL server 的市场越来越大了
<%
function OpenConn(userid,pass,servername)
connstring=&quot;Provider=SQLOLEDB.1;Password=&quot;
&amp;
pass &amp;
&quot;;Persist Security Info=True;User ID=&quot;
&amp;
userid &amp;&quot;;Data Source=&quot;
&amp;
servername
set conn=server.createobject(&quot;ADODB.Connection&quot;)
conn.open connstring
set OpenConn=conn
end function
%>
说到连接数据库,当然不能忘记Oracle
<%
function OpenConn(userid,pass,servername)
connstring=&quot;Provider=MSDAORA.1;Password=&quot;
&amp;
pass &amp;&quot;;User ID=&quot;
&amp;
userid &amp;
&quot;;Persist Security Info=True&quot;
set conn=server.createobject(&quot;ADODB.Connection&quot;)
conn.open connstring
set OpenConn=conn
end function
%>
当然还有 Access,ODBC 等等,我就只把 连接字符串放到这里,自己慢慢研究吧
connstring=&quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot;
&amp;
server.mappath(&quot;test.mdb&quot;) &amp;&quot;;Persist Security Info=False&quot;
//ACCESS
connstring=&quot;Provider=MSDASQL.1;Persist Security Info=False;Data Source=dsn&quot;
 
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot;
Content=&quot;Microsoft Visual Studio 6.0&quot;>
</HEAD>
<BODY>
<P>&amp;nbsp;</P>
<%
dim mysql
dim NewUserName,NewUserPWD,NewUserNickName,NewUserSex,NewQuestion,NewAnswer,NewEmail
NewUserName=Request.Form(&quot;UserName&quot;)
NewUserPWD=Request.Form(&quot;pwd1&quot;)
NewUserNickName=Request.Form(&quot;NickName&quot;)
NewUserSex=Request.Form(&quot;UserSex&quot;)
NewEmail=Request.Form(&quot;Email&quot;)
NewQuestion=Request.Form(&quot;Question&quot;)
NewAnswer=Request.Form(&quot;Answer&quot;)
set myrecord=server.CreateObject (&quot;ADODB.Recordset&quot;)
mysql=&quot;SELECT * FROM UserInfo WHERE NickName='&quot;
&amp;
NewUserName &amp;
&quot;'&quot;
myrecord.Open mysql,&quot;DSN=ChatRoom&quot;,1,3
if (instr(NewUserNickName, &quot;
&quot;) > 0) then
Response.Write &quot;昵称中含有非法字符!,请<a href='RegUser.asp'>重新注册</a>&quot;
else

If ((instr(NewEmail, &quot;@&quot;) = 0) or ((instr(NewEmail, &quot;.&quot;) = 0))) then
'If ( 1 <> 1) then
Response.Write &quot;E-mail地址非法,其格式为 demo@china.com(其中demo为用户名),请<a href='RegUser.asp'>重新注册</a>&quot;
else

if not myrecord.BOF then
Response.Write &quot;对不起!该用户名已经存在,请<a href='RegUser.asp'>重新注册</a>&quot;
else
myrecord.AddNew
myrecord(&quot;UserName&quot;)=NewUserName
myrecord(&quot;UserPass&quot;)=NewUserPWD
myrecord(&quot;NickName&quot;)=NewUserNickName
myrecord(&quot;UserSex&quot;)=NewUserSex
myrecord(&quot;UserQues&quot;)=NewQuestion
myrecord(&quot;Email&quot;)=NewEmail
myrecord(&quot;UserAns&quot;)=NewAnswer
myrecord(&quot;LogInTime&quot;)=Now()
myrecord(&quot;IPAdd&quot;)=Request.ServerVariables(&quot;REMOTE_ADDR&quot;)
myrecord.Update
Response.Write (&quot;恭喜你,你已经注册成功,在得到系统认证后,你可以<a href='Login.asp'>进入聊天室</a>&quot;)
End If
End If
End If
myrecord.Close
Set myrecord = nothing
%>
</BODY>
</HTML>
<HTML>
<BODY onload=&quot;&quot;>
<script language=vbscript>
</script>
</BODY>
</HTML>
 
接受答案了.
 
后退
顶部