Jump to content

vb 2008 .net login problem


Recommended Posts

Hey, ive made this code and i have an error, it says:

 

'ExecuteScalarQuery' is not a member of 'Oledb.OledbCommand'

 

code:

 

Imports System.Data.OleDb
Imports System.Data

Public Class Form2
    Dim result As String

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Start()
        Dim q1 As OleDb.OleDbCommand

        q1 = New OleDb.OleDbCommand("SELECT uniquestaffid FROM (staff) WHERE (username=`" & Form1.TextBox1.Text & "`)", New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=staff.mdb;User Id=Admin;Password=;"))

        MsgBox(q1.ExecuteScalarQuery.ToString())
    End Sub

    Private Sub errormsg()
        Timer1.Stop()
        result = MsgBox("Unable to book you on, please try again" & vbNewLine & vbNewLine & "Would you like to try again", vbYesNo, "Error")
        If result = MsgBoxResult.No Then
            Me.Hide()
            Form1.Show()
            Form1.TextBox1.Clear()
            Form1.TextBox2.Clear()
            Form1.DomainUpDown1.Text = "SELECT"
        Else
            Me.Hide()
            Form1.Show()
            Form1.TextBox1.Clear()
            Form1.TextBox2.Clear()
            Form1.DomainUpDown1.Text = "SELECT"
        End If
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim random As New Random
        Dim q1 As OleDb.OleDbCommand
        Dim sConnectionString As String

        sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=`staff.mdb`;User Id=;Password=;"

        If ProgressBar1.Value = ProgressBar1.Maximum Then
            Timer1.Stop()
            Me.Hide()
            Form1.Show()
            Form1.TextBox1.Clear()
            Form1.TextBox2.Clear()
            Form1.DomainUpDown1.Text = "SELECT"
        Else
            ProgressBar1.Value += random.Next(1, 2)
            If ProgressBar1.Value = 88 Then
                Timer1.Stop()

                q1 = New OleDb.OleDbCommand("SELECT uniquestaffid FROM (staff) WHERE (username=`" & Form1.TextBox1.Text & "`)", New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=`staff.mdb`;User Id=;Password=;"))

                Dim conn As New System.Data.OleDb.OleDbConnection(sConnectionString)
                conn.Open()

                If Form1.TextBox2.Text <> q1.ToString() Then
                    errormsg()
                Else
                    MsgBox("Successfully booked on", MsgBoxStyle.Information)
                    Me.Hide()
                    Form1.Show()
                    Form1.TextBox1.Clear()
                    Form1.TextBox2.Clear()
                    Form1.DomainUpDown1.Text = "SELECT"
                End If
            End If
        End If
    End Sub
End Class

 

any help please?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.