1,105,312 Community Members

Working with access database in Visual basic 2008 express edition

Member Avatar
sunilkumarasem
Newbie Poster
4 posts since Jul 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi, luc001!

I am using VB 2008 Express Edition and Access 2007. Here, i want some codes over the database connection issues like successful record updates after the connection is get closed, report generations and all with error handlings. So ll u please help me out with the issues.

Member Avatar
Reverend Jim
Noli mentula
5,394 posts since Aug 2010
Reputation Points: 746 [?]
Q&As Helped to Solve: 643 [?]
Skill Endorsements: 51 [?]
Moderator
Featured
 
0
 

Show us what you have done so far.

Member Avatar
artemix22
Junior Poster
111 posts since Jan 2012
Reputation Points: 4 [?]
Q&As Helped to Solve: 13 [?]
Skill Endorsements: 0 [?]
 
1
 

it's like you want us to do your homework here dude :D, show your progress so far

Member Avatar
sunilkumarasem
Newbie Poster
4 posts since Jul 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

ok frends i ll return here with my codes. wait for the time.

Member Avatar
sunilasem
Newbie Poster
2 posts since Jul 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Imports System.Data.OleDb
Public Class LoginForm1

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
    Try
        Dim con As New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=C:\Users\Euphoria\Documents\VodStore\VodStore\bin\Debug\VodStock.mdb")
        Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM Users WHERE userid = '" & UsernameTextBox.Text & "' AND password = '" & PasswordTextBox.Text & "' ", con)
        cmd.Connection.Open()
        'con.Open()
        Dim sdr As OleDbDataReader = cmd.ExecuteReader()
        ' If the record can be queried, Pass verification and open another form.   
        If (sdr.Read() = True) Then
            MessageBox.Show("Access Granted!")
            Form1.Show()
            Me.Hide()
        Else
            MessageBox.Show("Access Denied! Invalid username or password.")
        End If
    Catch es As Exception
        Beep()
        MsgBox(es.Message)
    End Try
End Sub

Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
    Me.Close()
End Sub

End Class

Here, i got a message of "Data type mismatch in crietria expression.". Please help me

Member Avatar
kRod
Junior Poster
139 posts since May 2012
Reputation Points: 49 [?]
Q&As Helped to Solve: 35 [?]
Skill Endorsements: 6 [?]
 
0
 

What is the datatype of your UserID in the "User" table? You are providing String Type to check against them in your table.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article