if ...... then
"请输入您的真实姓名!"
else
INSERT INTO database
response.redirect("ok.aspx")
end if
"请输入您的真实姓名!"
else
INSERT INTO database
response.redirect("ok.aspx")
end if
解决方案 »
- 怎样让ListView中的CheckBox实现单选?
- vs 2008 web控件问题
- asp页面能打开, aspx页面报错:HTTP 错误 404 - 文件或目录未找到。
- datatable.select()里怎样写类似于AND的语句?
- 我将文件存入数据库,怎样读出来?
- 请问如何读取一个文件并用Response.BinaryWrite()写出
- ★★急救新手!在ASP.NET中窗体之间参数传递的问题, 在线等!(来者有分)
- ISAPI来实现的URL重写,地址影射
- extjs在visual studio 2010中的智能提示问题
- cs怎样取得aspx中的文本框值?
- 请问:我想用aspx做一个textbox增强版,我该怎么做呢?
- 如何才算精通.NET和C#,要学多少?
Private Sub btsubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btsubmit.Click
If Page.IsValid Then
Dim myconnection As OleDb.OleDbConnection
Dim mycommand As OleDb.OleDbCommand
Dim mycommand2 As OleDb.OleDbCommand
Dim newuser As String
Dim insertstring As String
Dim querystring As String
Dim useraddress As String
Dim userbirthday1 As String
Dim userbirthday As Date
Dim registerdate As Date
querystring = "Select * from userinfo where(username='" + tbusername.Text + "')"
myconnection = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db\info.mdb"))
mycommand2 = New OleDb.OleDbCommand(querystring, myconnection)
myconnection.Open()
Dim myReader As OleDb.OleDbDataReader
myReader = mycommand2.ExecuteReader()
If myReader.HasRows Then
Page.RegisterStartupScript("MsgBox", "<script>alert('用户名:" & tbusername.Text & "已存在!');</script>")
myReader.Close()
myconnection.Close()
Else
Dim sexstring As String
If RMan.Checked Then
sexstring = "男"
Else
sexstring = "女"
End If
myReader.Close()
registerdate = Now()
useraddress = province.SelectedItem.Text & tbcity.Text & tbaddress.Text
userbirthday1 = tbyear.Text & "," & month.SelectedItem.Text & "," & day.SelectedItem.Text
userbirthday = CDate(userbirthday1)
insertstring = "Insert into userinfo(username,passward,question,answer,name,sex,address,birthday,email,phone,registerdate,online) values('" + tbusername.Text + "','" + tbpassward.Text + "','" + question.SelectedItem.Text + "','" + tbanswer.Text + "', '" + tbname.Text + "','" + sexstring + "','" + useraddress + "','" + userbirthday + "','" + tbemail.Text + "','" + tbphone.Text + "','" + registerdate + "','false')"
mycommand = New OleDb.OleDbCommand(insertstring, myconnection)
mycommand.ExecuteNonQuery()
myconnection.Close()
'Label1.Text = "注册成功!!"
newuser = tbusername.Text
tbpassward.Text = ""
tbrepassward.Text = ""
tbname.Text = ""
tbcity.Text = ""
tbaddress.Text = ""
tbyear.Text = ""
tbaddress.Text = ""
tbemail.Text = ""
tbphone.Text = ""
Page.RegisterStartupScript("MsgBox", "<script>alert('新用户:" & newuser & ",注册成功!');</script>")
Response.Redirect("index.aspx?user=" & System.Web.HttpUtility.UrlEncode(newuser)) End If
End If
End Sub
实现后退页面:Response.Write("<script>history.back(-1);script>");
如果要实现后退(B后退到A)后显示的页面自动刷新,在B中加:
Response.CacheControl = "no-cache";
如果验证通过则跳转到NEXT.ASPX:
Private Sub btresume_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btresume.Click
Response.Redirect("next.aspx")
End Sub