一个执行SQL语句的asp文件
把下面代码保存成up.asp文件,修改数据库地址,还有【sql=“SQL数据库执行语句“】感谢 Feather
-----------------
<%dim YD_SQL_SERVERIP,YD_SQL_UserName,YD_SQL_PassWord,YD_Main_DatabaseName
YD_SQL_SERVERIP=“(local)“ ‘数据库IP或数据库服务名
YD_SQL_UserName=“test“ ‘登录数据库用户名
YD_SQL_PassWord=“123369“ ‘登录数据库密码
YD_Main_DatabaseName=“test“ ‘主数据库名
dim conn
set conn=server.*object(“ADODB.connection“)
conn.open “PROVIDER=SQLOLEDB;DATA SOURCE=“&YD_SQL_SERVERIP&“;UID=“&YD_SQL_UserName&“;PWD=“&YD_SQL_PassWord&“;DATABASE=“&YD_Main_DatabaseName&““
If Err Then
err.Clear
Set Conn = Nothing
Response.Write “数据库连接出错,请检查连接字符串“
Response.End
End If
Response.ContentType = “text/vnd.wap.wml“
Response.Write “<?xml version=““1.0““ encoding=““utf-8““?>“
Response.Write “<!DOCTYPE wml PUBLIC ““-//WAPFORUM//DTD WML 1.1//EN““ ““http://www.wapforum.org/DTD/wml_1.1.xml““>“
Response.Write “<wml>“
Response.Write “<head>“
Response.Write “<meta name=““keywords““ content=““程序开发,Feather,myszd.com““ />“
Response.Write “<meta http-equiv=““Cache-Control““ content=““max-age=0““/>“
Response.Write “<meta http-equiv=““Cache-Control““ content=““no-cache““/>“
Response.Write “</head>“
Response.Write“<card title=““MSSQL操作““><p>“
dim ak
ak=Request.querystring(“ak“)
if ak=“ok“ Then
sql=“数据库语句“
conn.*ute(sql)
conn.close
set conn=Nothing
%>
<b>操作成功!</b><br/>
<%End If%>
<a href=“up.asp?ak=ok“>确定</a>
</p>
</card>
</wml>
发表评论