0

Hello experts,

I never used "Dataset" in my project. But I know this is used for the set of tables.
Can I use this to authenticate from more than one table?
Tables in my Database are:
Login, Student, Student Details, Fee, Teacher, Teacher Details.
I want to use dataset in my project to authenticate with Student, Student Details and Fee
table.
please help me to write the code for this.

3
Contributors
7
Replies
8
Views
5 Years
Discussion Span
Last Post by Pgmer
0
Try
            c.con.Open()
        Catch ex As Exception

            Dim cmd As New SqlCommand("select * from Login where (userid='" + txt_user.Text + "'and pass='" + txt_pass.Text + "'and type='" + txt_type.Text + "')", c.con)
            Dim dr As SqlDataReader
            dr = cmd.ExecuteReader()
            If (dr.Read()) Then
                If (txt_type.Text = "admin") Then

                    Dim frmobj As New MDIParent1
                    frmobj.Show()
                    Me.Hide()
                Else
                    MsgBox("Invalid User")
                    txt_user.Text = ""
                    txt_pass.Text = ""
                    txt_type.Text = ""
                    txt_user.Focus()
                End If
                If (txt_type.Text = "user") Then
                    Dim frmobj As New MDIParent1
                    frmobj.Show()
                    Me.Hide()
                ElseIf (txt_user.Text = "" Or txt_pass.Text = "" Or txt_type.Text = "") Then
                    MsgBox("userid,password or type is not correct.")
                Else
                    MsgBox("Invalid User")
                    txt_user.Text = ""
                    txt_pass.Text = ""
                    txt_type.Text = ""
                    txt_user.Focus()
                    dr.Close()
                End If
            End If
        End Try


        c.con.Close()

I written the above code to authenticate, But I have two tables:-
1. Username
2. password
Therefore, I have to authenticate my userform with two tables(username and password).
Can you tell me how can i use "dataset" in this coding.

0

well first remove your ( in your query, then how you want to authenticate the userform , ?? , what i understand is that you want to check the user name and password and the user type then load the form am i right ? so i think if you have two tables or more then two tables there is no need to use dataset , because you can perform same function with a single query , which is easy and fast .

Regards

0

Thankyou sir,
but i want to know,how to use dataset?

0

Data set is just like a table, you can get the data from database and load it into dataset and this dataset you can use to bing to grid or whatever.. Read about dataset in internet..

0

@Pgmer , with due respect sir , i think dataset is like a database having one or more then one tables in it , dataset and datatable are two different things , correct me sir if i am worng .

Best Regards

0

@waqasaslammmeo your correct... But not exactly like database. its just like a container..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.