关于VB同时执行两条SQL语句。求达人指教~

2025-12-13 23:07:15
推荐回答(1个)
回答1:

dim
isValidUserName
as
booleancn.CursorLocation
=
adUseClient
cn.Open
strCn
Name
=
Trim(Text1.Text)
sql
=
"select
username
from
Account
where
username='"
&
Name
&
"'"
rs.Open
sql,
cn,
1,
1isValidUserName=
rs.RecordCount
>
0rs.CloseIf isValidUserName
Then

Label5.Caption
=
"账号已存在"
Else

Label5.Caption
=
"帐号可以使用"
cn.Execute
"INSERT
INTO
account
(username,
sha_pass_hash,
email,
expansion)
VALUES
(
'"
&
Text1.Text
&
"
',
SHA1('Text2.Text')
,
'"
&
Text4.Text
&
"
','"
&
2
&
"
')
"

MsgBox
"注册成功"
End
Ifcn.Close
不该答你的问题啊,看到答案就关闭,让人比较郁闷