sql数据库连接问题
时间:2011-12-07
来源:互联网
下面的红色代码是 sw.mdb数据库的连接代码,因要转为SQL数据库,不知怎么连接,
SQL数据库用户名 "ta"
SQL数据库用户密码 "yaad3333"
SQL数据库名"#SW"
SQL服务器名 SOURCE=PC-201110101711\SQLEXPRESS;
有会修改的帮忙下,谢谢
<!--#include file="Start.asp"-->
<%
Dim clpp, clsl, czxm, Mail, Tel, Content, adress, addtime, wt1,wt2,wt3,wt4,wt5,wt6,wt7,wt8,wt9,wt10, exec
set conn=server.createobject("adodb.connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.open=server.mappath("/Database/sw.mdb")
clpp=request.form("clpp")
clsl=request.form("clsl")
czxm=request.form("czxm")
Mail = request.Form("Mail")
Tel=request.form("Tel")
Content=request.form("Content")
adress=request.form("adress")
Addtime=request.form("now()")
wt1=request.form("wt1")
wt2=request.form("wt2")
wt3=request.form("wt3")
wt4=request.form("wt4")
wt5=request.form("wt5")
wt6=request.form("wt6")
wt7=request.form("wt7")
wt8=request.form("wt8")
wt9=request.form("wt9")
wt10=request.form("wt10")
If len(clpp) < 2 Then
response.write "<script>alert(""请输入车辆品牌!"");history.back(-1);</script>"
response.end
End If
If len(clsl) < 1 Then
response.write "<script>alert(""请输入车量数量!"");history.back(-1);</script>"
response.end
End If
If len(czxm) < 2 Then
response.write "<script>alert(""请输入车主姓名!"");history.back(-1);</script>"
response.end
End If
If len(Tel) < 8 Then
response.write "<script>alert(""请正确输入电话号码!"");history.back(-1);</script>"
response.end
End If
If len(adress) < 2 Then
response.write "<script>alert(""请输入联系地址!"");history.back(-1);</script>"
response.end
End If
exec="insert into PE_Zxbm(clpp,clsl,czxm,Mail,Tel,Content,adress,wt1,wt2,wt3,wt4,wt5,wt6,wt7,wt8,wt9,wt10,addtime)values('"+clpp+"','"+clsl+"','"+czxm+"','"+Mail+"','"+Tel+"','"+Content+"','"+adress+"','"+wt1+"','"+wt2+"','"+wt3+"','"+wt4+"','"+wt5+"','"+wt6+"','"+wt7+"','"+wt8+"','"+wt9+"','"+wt10+"',now())"
conn.execute exec
conn.close
set conn=nothing
response.write "<script>alert(""报名成功!"");location.replace('index.html');</script>"
%>
SQL数据库用户名 "ta"
SQL数据库用户密码 "yaad3333"
SQL数据库名"#SW"
SQL服务器名 SOURCE=PC-201110101711\SQLEXPRESS;
有会修改的帮忙下,谢谢
<!--#include file="Start.asp"-->
<%
Dim clpp, clsl, czxm, Mail, Tel, Content, adress, addtime, wt1,wt2,wt3,wt4,wt5,wt6,wt7,wt8,wt9,wt10, exec
set conn=server.createobject("adodb.connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.open=server.mappath("/Database/sw.mdb")
clpp=request.form("clpp")
clsl=request.form("clsl")
czxm=request.form("czxm")
Mail = request.Form("Mail")
Tel=request.form("Tel")
Content=request.form("Content")
adress=request.form("adress")
Addtime=request.form("now()")
wt1=request.form("wt1")
wt2=request.form("wt2")
wt3=request.form("wt3")
wt4=request.form("wt4")
wt5=request.form("wt5")
wt6=request.form("wt6")
wt7=request.form("wt7")
wt8=request.form("wt8")
wt9=request.form("wt9")
wt10=request.form("wt10")
If len(clpp) < 2 Then
response.write "<script>alert(""请输入车辆品牌!"");history.back(-1);</script>"
response.end
End If
If len(clsl) < 1 Then
response.write "<script>alert(""请输入车量数量!"");history.back(-1);</script>"
response.end
End If
If len(czxm) < 2 Then
response.write "<script>alert(""请输入车主姓名!"");history.back(-1);</script>"
response.end
End If
If len(Tel) < 8 Then
response.write "<script>alert(""请正确输入电话号码!"");history.back(-1);</script>"
response.end
End If
If len(adress) < 2 Then
response.write "<script>alert(""请输入联系地址!"");history.back(-1);</script>"
response.end
End If
exec="insert into PE_Zxbm(clpp,clsl,czxm,Mail,Tel,Content,adress,wt1,wt2,wt3,wt4,wt5,wt6,wt7,wt8,wt9,wt10,addtime)values('"+clpp+"','"+clsl+"','"+czxm+"','"+Mail+"','"+Tel+"','"+Content+"','"+adress+"','"+wt1+"','"+wt2+"','"+wt3+"','"+wt4+"','"+wt5+"','"+wt6+"','"+wt7+"','"+wt8+"','"+wt9+"','"+wt10+"',now())"
conn.execute exec
conn.close
set conn=nothing
response.write "<script>alert(""报名成功!"");location.replace('index.html');</script>"
%>
作者: polinhua 发布时间: 2011-12-07
直接在sql 里用导入导出功能转.
作者: qianjin036a 发布时间: 2011-12-07
作者: fredrickhu 发布时间: 2011-12-07
引用 2 楼 fredrickhu 的回复:
http://blog.csdn.net/fredrickhu/article/details/4961799
http://blog.csdn.net/fredrickhu/article/details/4961799
可以在原来的代码修改下?文章那些代码始终不太一样,用了都有点错
作者: polinhua 发布时间: 2011-12-07
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28