Click here to Skip to main content
15,902,198 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: how to prevent program from open more than once at the same time? Pin
Mr.Kode4-Apr-07 14:21
Mr.Kode4-Apr-07 14:21 
AnswerRe: how to prevent program from open more than once at the same time? Pin
kubben4-Apr-07 11:18
kubben4-Apr-07 11:18 
GeneralRe: how to prevent program from open more than once at the same time? Pin
Mr.Kode4-Apr-07 14:22
Mr.Kode4-Apr-07 14:22 
GeneralRe: how to prevent program from open more than once at the same time? Pin
kubben4-Apr-07 14:25
kubben4-Apr-07 14:25 
AnswerRe: how to prevent program from open more than once at the same time? Pin
Xandip20-Apr-07 2:37
Xandip20-Apr-07 2:37 
Questionbinding radio buttons data Pin
abbss.gaurav4-Apr-07 7:48
abbss.gaurav4-Apr-07 7:48 
AnswerRe: binding radio buttons data Pin
Christian Graus4-Apr-07 10:15
protectorChristian Graus4-Apr-07 10:15 
Questiondata reader giving problem Pin
abbss.gaurav4-Apr-07 7:41
abbss.gaurav4-Apr-07 7:41 
i m usin data reader in my login form.
wat i want to do is by data reader i can read data from tables
that i created. n be able to open other forms accordingly.
.....the problem is that that when i run the application,,no matter what i type
it only shows me the matter of first text box "you r logged on as student".....

here is the code

Imports System.Windows.Forms.Form
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlClient.SqlCommand


Public Class logon
Inherits System.Windows.Forms.Form
Dim objsqlconn As SqlConnection
Dim logonselect As String = "select * from logon"
Dim objsqlcmd As New SqlCommand(logonselect, objsqlconn)
Dim dr As SqlDataReader

Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
objsqlconn = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\Administrator.WINXP_PRO_CORP.002\Desktop\WindowsApplication1\WindowsApplication1\Database1.mdf;Integrated Security=True;User Instance=True")
objsqlcmd = New SqlCommand
objsqlcmd.Connection = objsqlconn
objsqlconn.Open()
objsqlcmd.CommandType = Data.CommandType.Text
objsqlcmd.CommandText = "select * from logon"
dr = objsqlcmd.ExecuteReader()
Dim str As String
Dim a As New mdiparent
While dr.Read()
str = dr.GetString(0)
If str = "student" Then
MessageBox.Show("you are loged on as student")
a.Show()
End If

If str = "administrator" Then
MessageBox.Show("you are loged on as administrator")
a.Show()

End If

If str = "lass1" Or "lass2" Or "lass3" Or "lass4" Or "lass5" Or "lass6" Or "lass7" Or "lass8" Then
MessageBox.Show("you are loged on as lab assistant")
a.Show()

End If

End While

dr.Close()
objsqlconn.Close()



End Sub

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

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Focus()



End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Dispose()
End Sub
End Class


can somebody please tell me where the problem is????
AnswerRe: data reader giving problem Pin
Colin Angus Mackay4-Apr-07 11:05
Colin Angus Mackay4-Apr-07 11:05 
Questionhw to delete row from data grid in run time??? Pin
abbss.gaurav4-Apr-07 7:31
abbss.gaurav4-Apr-07 7:31 
AnswerRe: hw to delete row from data grid in run time??? Pin
Johan Hakkesteegt9-Apr-07 20:13
Johan Hakkesteegt9-Apr-07 20:13 
QuestionHELP! Custom Eye-dropper Pin
gatorlaid4-Apr-07 7:21
gatorlaid4-Apr-07 7:21 
GeneralQuick Watch Error "Cannot Obtain Value" Pin
jPucci4-Apr-07 7:11
jPucci4-Apr-07 7:11 
QuestionDialog boxes Pin
Diego F.4-Apr-07 5:26
Diego F.4-Apr-07 5:26 
AnswerRe: Dialog boxes Pin
Kschuler4-Apr-07 6:11
Kschuler4-Apr-07 6:11 
GeneralRe: Dialog boxes Pin
Diego F.10-Apr-07 1:33
Diego F.10-Apr-07 1:33 
GeneralRe: Dialog boxes Pin
Kschuler10-Apr-07 2:46
Kschuler10-Apr-07 2:46 
GeneralRe: Dialog boxes Pin
Diego F.10-Apr-07 4:11
Diego F.10-Apr-07 4:11 
GeneralRe: Dialog boxes Pin
Kschuler10-Apr-07 4:15
Kschuler10-Apr-07 4:15 
GeneralRe: Dialog boxes Pin
Diego F.10-Apr-07 4:59
Diego F.10-Apr-07 4:59 
QuestionCombobox again Pin
Jodd4-Apr-07 5:07
Jodd4-Apr-07 5:07 
AnswerRe: Combobox again Pin
Kschuler4-Apr-07 6:14
Kschuler4-Apr-07 6:14 
GeneralRe: Combobox again Pin
Jodd4-Apr-07 6:28
Jodd4-Apr-07 6:28 
GeneralRe: Combobox again Pin
Kschuler4-Apr-07 7:40
Kschuler4-Apr-07 7:40 
GeneralRe: Combobox again Pin
Jodd4-Apr-07 13:48
Jodd4-Apr-07 13:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.