End Class  

End Class

Другой, более сложный вариант вариант:

Imports Microsoft.VisualBasic

Imports System.Configuration

Imports System.Data 'подключаю классы работы с БД

Imports System.Data.OleDb 'для использования формата данных DataView

Imports System.Web.Security

Imports System.Web.UI.HtmlControls

Imports System.Web.UI.WebControls

Imports System.DBNull

Partial Class _Default

Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim dv As DataView

Dim id, p, l, fio As String

If TextBox1.Text "" Or TextBox2.Text "" Then

dv = CType(SqlDataSource1.Select(DataSourceSelectArguments.Empty), DataView) 'получаю результат запроса SELECT

If dv.Count 0 Then 'проверка есть ли данные в запросе

id = CType(dv.Table(0)(0), String) 'записываю в переменную id

p = CType(dv.Table(0)(1), String) 'записываю в переменную пароль

l = CType(dv.Table(0)(2), String) 'записываю в переменную логин

fio = CType(dv.Table(0)(3), String)

'Label1.Text = "Вы уже прошли регистрацию!Здравствуйте," & fio

'Label1.Visible = True

Session.Add("id_user", id)

Session.Add("fio", fio)

SqlDataSource2.Delete()

Response.Redirect("./end_reg.aspx")

End If

If dv.Count = 0 Then

Label1.Text = "Введите регистрационные данные"

Label1.Visible = True

Button2.Visible = True

Button3.Visible = True

TextBox3.Visible = True

TextBox4.Visible = True

Label4.Visible = True

Label5.Visible = True

Button1.Visible = False

End If

End If

End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Label1.Visible = False

Label2.Text = "Login"

Label3.Text = "Пароль"

Label4.Visible = False

Label5.Visible = False

Label4.Text = "ФИО"

Label5.Text = "e-mail"

Button2.Visible = False

Button3.Visible = False

Button4.Visible = False

TextBox3.Visible = False

TextBox4.Visible = False

End Sub

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click

TextBox1.Text = ""

TextBox2.Text = ""

TextBox1.Focus()

Label1.Visible = False

Button2.Visible = False

Button3.Visible = False

TextBox3.Visible = False

TextBox4.Visible = False

Button1.Enabled = True

Label4.Visible = False

Label5.Visible = False

End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click



If TextBox3.Text "" And TextBox4.Text "" Then

SqlDataSource1.Insert()

TextBox1.Text = ""

TextBox2.Text = ""

TextBox1.Enabled = False

TextBox2.Enabled = False

Button1.Enabled = False

Button2.Visible = False

Button3.Visible = False

Button4.Visible = True

'Session.Add("id_user", ID)

Response.Redirect("./Reg.aspx")

Else : Label1.Text = "Введите регистрационные данные!"

End If

End Sub

Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click

Button1.Enabled = True

Response.Redirect("./Main.aspx")

End Sub

End Class


1785978534740031.html
1786008615277520.html
    PR.RU™