Wednesday, January 19, 2011

Select Query

 Design:


Imports System.Data
Imports System.Data.OleDb


Public Class Form1

    Dim cn As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\Maulik Dave\Documents\loginform.mdb")


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

        Dim adp As New OleDbDataAdapter("Select * from tablogin where username= '" & TextBox1.Text & "' and password='" & TextBox2.Text & "' ", cn)
        Dim ds As New DataSet

        adp.Fill(ds)

        If (ds.Tables(0).Rows.Count > 0) Then

            Me.Hide()
            signup.Show()

        Else

            MsgBox("Program Failed")

        End If



        cn.Close()

    End Sub

End Class