當前位置:編程學習大全網 - 源碼下載 - 300分求:做壹個VB程序讀遠程服務器端ASP的response.write"..."的信息

300分求:做壹個VB程序讀遠程服務器端ASP的response.write"..."的信息

Public Class Form1

Inherits System.Windows.Forms.Form

#Region " Windows 窗體設計器生成的代碼 "

Public Sub New()

MyBase.New()

'該調用是 Windows 窗體設計器所必需的。

InitializeComponent()

'在 InitializeComponent() 調用之後添加任何初始化

End Sub

'窗體重寫 dispose 以清理組件列表。

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

components.Dispose()

End If

End If

MyBase.Dispose(disposing)

End Sub

'Windows 窗體設計器所必需的

Private components As System.ComponentModel.IContainer

'註意: 以下過程是 Windows 窗體設計器所必需的

'可以使用 Windows 窗體設計器修改此過程。

'不要使用代碼編輯器修改它。

Friend WithEvents Label1 As System.Windows.Forms.Label

Friend WithEvents Label2 As System.Windows.Forms.Label

Friend WithEvents txtUserName As System.Windows.Forms.TextBox

Friend WithEvents btnLogin As System.Windows.Forms.Button

Friend WithEvents btnCancle As System.Windows.Forms.Button

Friend WithEvents txtPassWord As System.Windows.Forms.TextBox

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

Me.Label1 = New System.Windows.Forms.Label

Me.Label2 = New System.Windows.Forms.Label

Me.btnLogin = New System.Windows.Forms.Button

Me.btnCancle = New System.Windows.Forms.Button

Me.txtUserName = New System.Windows.Forms.TextBox

Me.txtPassWord = New System.Windows.Forms.TextBox

Me.SuspendLayout()

'

'Label1

'

Me.Label1.AutoSize = True

Me.Label1.Location = New System.Drawing.Point(24, 24)

Me.Label1.Name = "Label1"

Me.Label1.Size = New System.Drawing.Size(48, 17)

Me.Label1.TabIndex = 0

Me.Label1.Text = "用戶名:"

'

'Label2

'

Me.Label2.AutoSize = True

Me.Label2.Location = New System.Drawing.Point(24, 48)

Me.Label2.Name = "Label2"

Me.Label2.Size = New System.Drawing.Size(35, 17)

Me.Label2.TabIndex = 1

Me.Label2.Text = "密碼:"

'

'btnLogin

'

Me.btnLogin.Location = New System.Drawing.Point(32, 88)

Me.btnLogin.Name = "btnLogin"

Me.btnLogin.TabIndex = 2

Me.btnLogin.Text = "登錄"

'

'btnCancle

'

Me.btnCancle.Location = New System.Drawing.Point(136, 88)

Me.btnCancle.Name = "btnCancle"

Me.btnCancle.TabIndex = 3

Me.btnCancle.Text = "取消"

'

'txtUserName

'

Me.txtUserName.Location = New System.Drawing.Point(80, 16)

Me.txtUserName.Name = "txtUserName"

Me.txtUserName.TabIndex = 4

Me.txtUserName.Text = ""

'

'txtPassWord

'

Me.txtPassWord.Location = New System.Drawing.Point(80, 40)

Me.txtPassWord.Name = "txtPassWord"

Me.txtPassWord.PasswordChar = Microsoft.VisualBasic.ChrW(42)

Me.txtPassWord.TabIndex = 5

Me.txtPassWord.Text = ""

'

'Form1

'

Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)

Me.ClientSize = New System.Drawing.Size(240, 127)

Me.Controls.Add(Me.txtPassWord)

Me.Controls.Add(Me.txtUserName)

Me.Controls.Add(Me.btnCancle)

Me.Controls.Add(Me.btnLogin)

Me.Controls.Add(Me.Label2)

Me.Controls.Add(Me.Label1)

Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog

Me.MaximizeBox = False

Me.MinimizeBox = False

Me.Name = "Form1"

Me.Text = "登錄"

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub btnCancle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancle.Click

Me.Close()

End Sub

Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click

If Me.txtUserName.Text.Trim.Length = 0 Or Me.txtPassWord.Text.Trim.Length = 0 Then

MsgBox("請輸入用戶名或密碼")

Exit Sub

End If

Dim conString As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=D:\Inetpub\wwwroot\WebApplication1\Database\Test.mdb"

Dim conn As New OleDb.OleDbConnection(conString)

Dim comm As New OleDb.OleDbCommand("SELECT UserName, PassWord FROM UserInfo WHERE UserName = '" & Me.txtUserName.Text & "'", conn)

Try

conn.Open()

Dim dr As OleDb.OleDbDataReader = comm.ExecuteReader()

If dr.HasRows Then

dr.Read()

If dr.Item("PassWord").ToString = Me.txtPassWord.Text Then

MsgBox("登錄成功")

Else

MsgBox("登錄失敗")

End If

End If

dr.Close()

Catch ex As Exception

MsgBox(ex.ToString)

Finally

If conn.State = ConnectionState.Open Then conn.Close()

conn.Dispose()

comm.Dispose()

End Try

End Sub

End Class

/home/20051101/10/4363173.html

或參考

/question/8176586.html

  • 上一篇:翻譯壹下
  • 下一篇:天津租房用什麽app租房子應該註意什麽
  • copyright 2024編程學習大全網