Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

vb.net 2010 to ms express database

$
0
0
[code][code]
[/code][/code]
 Imports System.Data
Imports System.Data.OleDb
Public Class Form1
    Dim provider As String
    Dim connstring As String
    Dim myconnection As OleDbConnection = New OleDbConnection
    Dim dbUp As New OleDb.OleDbCommand
    Dim Read As OleDb.OleDbDataReader
    Dim datafile As String

    Private Sub LoginBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoginBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.LoginBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.LoginDataSet)


    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'LoginDataSet.login' table. You can move, or remove it, as needed.

    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub

    Private Sub ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.LoginTableAdapter.Fill(Me.LoginDataSet.login)
        provider = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
        datafile = "D:\project\project smart\login1\login1\LoginDataSet.xsd"
        connstring = provider & datafile
        myconnection.ConnectionString = connstring
        myconnection.Open()
        dbUp.CommandType = CommandType.Text
        dbUp.CommandText = "Select * from LOGIN where Username=yes and Password=no "
        dbUp.Parameters.Add("Username", Data.OleDb.OleDbType.Variant)
        dbUp.Parameters.Add("Password", Data.OleDb.OleDbType.Variant)
        dbUp.Parameters("Username").Value = UsernameTextBox.Text
        dbUp.Parameters("Password").Value = PasswordTextBox.Text
        Read = dbUp.ExecuteReader
        With Read
            If .Read Then
                Me.Hide()
                Form2.Show()
            Else
                UsernameTextBox.Clear()
                PasswordTextBox.Clear()
                MessageBox.Show("Invalid Username or Password")
                UsernameTextBox.Focus()
            End If
        End With
    End Sub

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>