i wonder why my code have an error.. this my code and i will highlight the error

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

        Dim connection As New SqlClient.SqlConnection
        Dim command As New SqlClient.SqlCommand
        Dim adapter As New SqlClient.SqlDataAdapter
        Dim dataset As New DataSet

        connection.ConnectionString = ("Data Source=CUBED-DESKTOP05;Initial Catalog=Biometrics;Integrated Security=True")


        command.CommandText = " SELECT * FROM (admin) WHERE username= '" & TextBox1.Text & "' AND password= '" & TextBox2.Text & "';"


        command.Connection = connection

        adapter.SelectCommand = command
' this part is where the error made
adapter.Fill(dataset, "0")

        Dim count = dataset.Tables(0).Rows.Count

        If count > 0 Then
            MsgBox("Welcome to Cubed Technologies", MsgBoxStyle.OkOnly)
            MsgBox("Incorrect Login please Check your Username and Password")

        End If

    End Sub

What exactly is the error message ?

Why the table name is within parenthesis ?

NOTE:--Do not use dataset as name of an object, it is a predefined key word..

Erase -ve rep
error stated

Dont complicate things. Do it like this:

Dim conn As New SqlConnection("connString")
Dim da As New SqlDataAdapter()
Dim table As New DataTable()
da.SelectCommand.CommandText = "your select query"
da.SelectCommand.Connection = conn

And you dont have to use DataSet,if you only have one DataTable. Instead you use DataTable, as I showed in example.

This article has been dead for over six months. Start a new discussion instead.