📄 register.aspx
字号:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Import Namespace="System.data.sqlclient" %>
<%@ Import Namespace="System.data" %>
<script runat="server">
Dim sqlcon As New SqlConnection
Dim sql1 As New SqlDataAdapter
Dim ds As New DataSet
Dim demp1 As DataTable
Dim dr1 As DataRow
Dim cmd2 As New SqlCommand
Dim autogen As Long
Function Fixquotes(ByVal thesqlenemy As String)
Fixquotes = Replace(thesqlenemy, "'", "''")
End Function
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
If Page.IsValid Then
sqlcon = New SqlConnection("Data Source=.; database =BookStore;Integrated Security=True")
sql1.SelectCommand = New SqlCommand
sql1.SelectCommand.Connection = sqlcon
sql1.SelectCommand.CommandText = "select * from tbCustomer_Detail"
sql1.Fill(ds, "tbCustomer_Detail")
demp1 = ds.Tables("tbCustomer_Detail")
dr1 = ds.Tables("tbCustomer_Detail").NewRow
dr1.Item(0) = first_name.Text
dr1.Item(1) = last_name.Text
dr1.Item(2) = username.Text
dr1.Item(3) = userpass.Text
dr1.Item(4) = email.Text
dr1.Item(5) = phno.Text
dr1.Item(6) = address.Text
dr1.Item(7) = sq.Text
dr1.Item(8) = sa.Text
dr1.Item(9) = country.Text
dr1.Item(10) = gender.Text
dr1.Item(11) = age.Text
dr1.Item(12) = user_doj.Text
Dim chkUsername As IDbCommand
Dim chkclintemail As IDbCommand
Dim strSQL1 As String
Dim strSQL2 As String
Dim strUserCount As Integer
Dim strCount1 As Integer
strSQL1 = "SELECT COUNT(*) FROM [tbCustomer_Detail] WHERE [CustomerId]='" & Fixquotes(username.Text) & "'"
strSQL2 = "SELECT COUNT(*) FROM [tbCustomer_Detail] WHERE [CustomerEmail]='" & Fixquotes(email.Text) & "'"
sqlcon.Open()
chkUsername = New SqlCommand(strSQL1, sqlcon)
strCount1 = chkUsername.ExecuteScalar()
chkclintemail = New SqlCommand(strSQL2, sqlcon)
strUserCount = chkclintemail.ExecuteScalar()
If strCount1 <> 0 Then
MsgBox("UserlID already exists. Please choose another...", MsgBoxStyle.Critical, "User ID Exixts")
ElseIf (first_name.Text = "") Then
MsgBox("Please enter first name", MsgBoxStyle.Information, "First Name")
ElseIf (last_name.Text = "") Then
MsgBox("Please enter last name", MsgBoxStyle.Information, "Last Name")
ElseIf (username.Text = "") Then
MsgBox("Please enter username for registration", MsgBoxStyle.Information, "User Name")
ElseIf (userpass.Text = "") Then
MsgBox("Please Enter Password", MsgBoxStyle.Information, "Password")
ElseIf (email.Text = "") Then
MsgBox("Enter Email ID", MsgBoxStyle.Information, "Email Address")
ElseIf strUserCount <> 0 Then
MsgBox("EMaiID already exists. Please choose another...", MsgBoxStyle.Critical, "ID Exixts")
ElseIf (phno.Text = "") Then
MsgBox("Please Enter Your Contact Number", MsgBoxStyle.Information, "Enter Contact Number")
ElseIf (address.Text = "") Then
MsgBox("Please Enter Your Parmanent Address", MsgBoxStyle.Information, "Enter Address")
ElseIf (sq.SelectedIndex = "0") Then
MsgBox("Please select sequrity question", MsgBoxStyle.Information, "Security Question")
ElseIf (sa.Text = "") Then
MsgBox("Please inter your answer", MsgBoxStyle.Information, "Security Answer")
ElseIf (country.SelectedIndex = "0") Then
MsgBox("Please select country from the list", MsgBoxStyle.Information, "Select Country")
ElseIf (gender.SelectedIndex = "0") Then
MsgBox("Please select gender", MsgBoxStyle.Information, "Select Gender")
ElseIf (age.SelectedIndex = "0") Then
MsgBox("Please select your age", MsgBoxStyle.Information, "Select Age")
ElseIf (user_doj.Text = "") Then
MsgBox("Please Enter Date", MsgBoxStyle.Information, "Enter Date")
Else
ds.Tables("tbCustomer_Detail").Rows.Add(dr1)
sql1.InsertCommand = New SqlCommand
sql1.InsertCommand.Connection = sqlcon
sql1.InsertCommand.CommandText = "insert into tbCustomer_Detail(FirstName,LastName,CustomerId,CustomerPass,CustomerEmail,CustomerAdd,CustomerPh,Customer_sq,Customer_sa,Country,Gender,Age,RegDate) values('" & first_name.Text & "','" & last_name.Text & "','" & username.Text & "','" & userpass.Text & "','" & email.Text & "','" & address.Text & "','" & phno.Text & "','" & sq.Text & "','" & sa.Text & "','" & country.Text & "','" & gender.Text & "','" & age.Text & "','" & user_doj.Text & "')"
sql1.Update(dr1.Table)
MsgBox("Your Registration Has Been Succesfully Done,Please Login", MsgBoxStyle.Information, "Registration Done")
Response.Redirect("myaccount.aspx")
End If
'Catch ex As Exception
' MsgBox(ex.Message.ToString())
' End Try
End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim doj As Date
doj = System.DateTime.Now.Date
user_doj.text = doj
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>Book Store</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<form id="form1" runat ="server"><div id="wrap">
<div class="header">
<div class="logo"><a href="index.aspx"><img src="images/logo.gif" alt="" title="" border="0" /></a></div>
<div id="menu">
<ul>
<li><a href="index.aspx">home</a></li>
<li><a href="about.html">about us</a></li>
<li><a href="category.html">books</a></li>
<li><a href="specials.html">specials books</a></li>
<li><a href="myaccount.aspx">my accout</a></li>
<li class="selected"><a href="register.aspx">register</a></li>
<li><a href="details.html">prices</a></li>
<li><a href="contact.aspx">contact</a></li>
</ul>
</div>
</div>
<div class="center_content">
<div class="left_content">
<div class="title"><span class="title_icon"><img src="images/bullet1.gif" alt="" title="" /></span>Register</div>
<div class="feat_prod_box_details">
<p class="details">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud.
</p>
<div class="contact_form" style="z-index: 100">
<div class="form_subtitle">create new account</div>
<table style="width: 83%">
<tr>
<td>
<strong>First Name:</strong></td>
<td>
<asp:TextBox ID="first_name" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<strong>Last Name:</strong></td>
<td>
<asp:TextBox ID="last_name" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<strong>Username:</strong></td>
<td>
<asp:TextBox ID="username" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<strong>Password:</strong></td>
<td>
<asp:TextBox ID="userpass" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<strong>Email:</strong></td>
<td>
<asp:TextBox ID="email" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<strong>Phone:</strong></td>
<td>
<asp:TextBox ID="phno" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<strong>Address:</strong></td>
<td>
<asp:TextBox ID="address" runat="server"></asp:TextBox></td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -