English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Imports System.Data.OleDb
Public Class Form1
Inherits System.Windows.Forms.Form
Public conn As New OleDbConnection
Public connectstring As String = String.Empty
Public comm As New OleDbCommand
Public dr As OleDbDataReader
Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
Dim DataSource As String
Dim strUserName As String = String.Empty
Dim strPassword As String = String.Empty

strUserName = txtUserName.Text
strPassword = txtPassword.Text

connectstring = "Provider = Microsoft.Jet.OLEDB.4.0"
DataSource = "C:\Documents and Settings\Administrator\My Documents\double module\Online Sales and Inventory"

conn.Open()
comm.Connection = conn

2006-07-23 17:35:39 · 1 answers · asked by braich_gal 3 in Computers & Internet Programming & Design

comm.CommandText = "SELECT User Name, Password FROM AuthorizedStaffInventory WHERE User name='" & strUserName & "' and password='" & strPassword & "'"
dr = comm.ExecuteReader(CommandBehavior.CloseConnection)
If dr.HasRows Then
dr.Close()
conn = Nothing
comm = Nothing
dr = Nothing
Welcome.Activate()
ElseIf Not dr.IsClosed Then
MsgBox("Invalid user name or password! Please try again.", MsgBoxStyle.OKOnly, "Log In Failed!")
End If

End Sub

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

End Sub
End Class

2006-07-23 17:36:27 · update #1

error in Welcome.Activate()..error tip given:reference to a non-shared member requires an object reference

it's supposed to be the code to link to the next page when login is succesful...

2006-07-23 17:38:41 · update #2

please correct the mistakes...this is urgent!!

2006-07-23 17:39:27 · update #3

1 answers

is Welcome a form?

If yes, you must instantiate the form

IE:
dim frmWelcome as New Welcom
frmWelcome.show

in vb6 you could call forms without instantiating, not in vb.net =)

2006-07-23 20:20:43 · answer #1 · answered by Anonymous · 0 0

fedest.com, questions and answers