DW网页制作asp.net注册页面(VB语句)
DW网页制作asp.net做一个注册页面(VB语句)这是我的语句:<scriptlanguage="vb"runat="server">subpage_load(send...
DW网页制作asp.net做一个注册页面(VB语句)
这是我的语句:
<script language="vb" runat="server" >
sub page_load(sender as object,e as eventargs)
end sub
sub ok_click(sender as object,e as eventargs)
dim cmd As SqlCommand
Dim mrc As SqlDataReader
Dim MyConnection As SqlConnection
MyConnection = New SqlConnection("server=127.0.0.1;user id=sa;password=;database=asp")
MyConnection.Open()
dim str="select count(*) from user_ where 用户名='" & username.text & "'"
cmd = New SqlCommand(str)
cmd.Connection = MyConnection
cmd.CommandType = Data.CommandType.Text
mrc = cmd.ExecuteReader()
While mrc.Read
If (mrc.GetValue(0)) = 1 Then
MsgBox ("此用户名已存在,请重新输入!")
else
dim mysex as string
if sex1.checked then
mysex="男"
else
mysex="女"
end if
dim abc as string
if CheckBox1.checked then abc="羽毛球、 "
if CheckBox2.checked then abc=abc & "听音乐、 "
if CheckBox3.checked then abc=abc & "玩游戏、 "
if CheckBox4.checked then abc=abc & "旅游"
str="insert into user_ values('" & username.text & "','" & password.text & "','" & mysex & "','" & email.text & "','" & abc & "')"
cmd.CommandText = str
end if
MyConnection.Close()
End While
end sub
</script>
是我自己写的,运行时出错!
大家帮我改改~!
强调:在我原有的基础上作改~!且一定要用VB写~!谢谢~! 展开
这是我的语句:
<script language="vb" runat="server" >
sub page_load(sender as object,e as eventargs)
end sub
sub ok_click(sender as object,e as eventargs)
dim cmd As SqlCommand
Dim mrc As SqlDataReader
Dim MyConnection As SqlConnection
MyConnection = New SqlConnection("server=127.0.0.1;user id=sa;password=;database=asp")
MyConnection.Open()
dim str="select count(*) from user_ where 用户名='" & username.text & "'"
cmd = New SqlCommand(str)
cmd.Connection = MyConnection
cmd.CommandType = Data.CommandType.Text
mrc = cmd.ExecuteReader()
While mrc.Read
If (mrc.GetValue(0)) = 1 Then
MsgBox ("此用户名已存在,请重新输入!")
else
dim mysex as string
if sex1.checked then
mysex="男"
else
mysex="女"
end if
dim abc as string
if CheckBox1.checked then abc="羽毛球、 "
if CheckBox2.checked then abc=abc & "听音乐、 "
if CheckBox3.checked then abc=abc & "玩游戏、 "
if CheckBox4.checked then abc=abc & "旅游"
str="insert into user_ values('" & username.text & "','" & password.text & "','" & mysex & "','" & email.text & "','" & abc & "')"
cmd.CommandText = str
end if
MyConnection.Close()
End While
end sub
</script>
是我自己写的,运行时出错!
大家帮我改改~!
强调:在我原有的基础上作改~!且一定要用VB写~!谢谢~! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询