免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
ASP連接SQL服務(wù)器代碼

<%

userAcc=request.Form("userAccount")

userPsw=request.Form("userPsw")

userName=request.Form("userName")

userSex=request.Form("userSex")

Dim StrServer,StrUid,StrSaPwd,StrDbName

StrServer=".\SQLEXPRESS" '數(shù)據(jù)庫服務(wù)器名,如果數(shù)據(jù)庫放在了根目錄里,數(shù)據(jù)庫服務(wù)器名就是(local)

StrUid="sa" '您的登錄賬號(hào),采用SQL身份驗(yàn)證時(shí)輸入的賬號(hào)

StrSaPwd="12345" '您的登錄密碼,采用SQL身份驗(yàn)證時(shí)輸入的密碼

StrDbName="MyDatabase" '您的數(shù)據(jù)庫名稱

Dim Conn '數(shù)據(jù)庫連接

Dim StrDSN '數(shù)據(jù)庫連接字符串

Dim Rs '命令字符串

StrDSN="driver={SQL server};server="&StrServer&";uid="&StrUid&";pwd="&StrSaPwd&";database="&StrDbName

'建立和數(shù)據(jù)庫master的連接

set Conn = Server.CreateObject("ADODB.Connection")

set Rs=Server.CreateObject("ADODB.RecordSet")

Conn.Open StrDSN

'********************************************************************

'********************************************************************
'向數(shù)據(jù)庫中添加記錄

sub recordAdd()

if userName="" or userPsw="" then

    response.Write "The User Name or Password cannot be empty!!":exit Sub

end if

dim strSql1

strSql1="select UserName from test"

rs.open strSql1,Conn,1,1

do while not rs.EOF

for i=0 to rs.Fields.Count-1

if userName=rs.Fields(i).Value then

   response.Write "The user existed,record Add Failed":exit Sub

end if

next

rs.MoveNext

loop

rs.Close

dim strSql3

strSql3="INSERT INTO test(userAccount,userPsw,userName,userSex) VALUES('"&userAcc&"','"&userPsw&"','"&userName&"','"&userSex&"')"

rs.open strSql3,Conn,1,3

response.Write "Record successfully!"

end Sub
 

Sub readdb()

dim strSql2

strSql2="select * from test"

rs.open strSql2,Conn,1,1

if rs.EOF then response.write "no record at all":exit sub

response.write "<table border=1 align='center'>"

response.write "<tr>"

for i=0 to rs.Fields.Count-1

response.write "<td><font color=blue>"&rs.Fields(i).Name&"</font></td>"

next

response.write "</tr>"

while not rs.EOF

response.write "<tr>"

for i=0 to rs.Fields.Count-1

response.write "<td>"&rs.Fields(i).Value&"</td>"

next

response.write "</tr>"

rs.MoveNext

wend

response.write "</table>"

rs.Close

end Sub

 

'釋放數(shù)據(jù)庫連接對(duì)象

set rs=nothing

set conn=nothing

%>

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
asp 學(xué)習(xí)筆記
萬網(wǎng):我進(jìn)來玩過兩次了
Excel VBA 連接 MySQL 數(shù)據(jù)庫遇到的“巨坑”
利用JSP的思想來做ASP
asp防止同時(shí)登陸的問題
為動(dòng)態(tài)網(wǎng)站制作RSS內(nèi)容輸出的程序模版
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服