chris_rulez001 Posted August 17, 2008 Share Posted August 17, 2008 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? Quote Link to comment Share on other sites More sharing options...
coldfiretech Posted August 23, 2008 Share Posted August 23, 2008 What kind of database are you using? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.