Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 18th, 2005, 11:54 AM
Authorized User
 
Join Date: Jan 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error - Missing operator in query expression.

I looked at the code below for the past 2 days and cannot see anything wrong with it but I am getting an error. Please help.......... Thanks


Private Sub btnReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReport.Click
        Dim myConnection As OleDbConnection = New _
                OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=G:\IDC\Received Dispensed Deleted.mdb;User Id=admin;Password=;")
        Dim myDataAdapter As New OleDbDataAdapter
        Dim myDataSet As DataSet = New DataSet
        'Set the SelectCommand properties...
        myDataAdapter.SelectCommand = New OleDbCommand
        myDataAdapter.SelectCommand.Connection = myConnection
        myDataAdapter.SelectCommand.CommandText = "SELECT Received, Dispensed, Destroyed" & _
        "FROM Received " & _
        "JOIN Dispensed ON Received.Received = Dispensed.Dispensed " & _
        "JOIN Destroyed ON Received.Received = Destroyed.Destroyed "
        myDataAdapter.SelectCommand.CommandType = CommandType.Text

        myConnection.Open()
        Try
            myDataAdapter.SelectCommand.ExecuteNonQuery()
            'Fill the DataSet object with data
            myDataAdapter.Fill(myDataSet, "Received")
        Catch err As OleDbException
            MessageBox.Show(err.Message)
        Finally
            myConnection.Close()
        End Try
        'set the DataGrid properties to bind it to our data.....
        GridDrug.DataSource = myDataSet
        GridDrug.DataMember = "Received"
    End Sub
 
Old January 18th, 2005, 12:34 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

You need a space after “Destroyed” in

...Destroyed" & _

Should be

...Destroyed " & _

The way you have it evaluates to “... DestroyedFROM ...”





Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax error (missing operator) ppenn Classic ASP Basics 3 November 5th, 2007 02:26 PM
Syntax error (missing operator) in query expressio annwilly Classic ASP Databases 1 June 7th, 2006 09:53 AM
Syntax Error /missing operator in Query Expression dsealer Classic ASP Databases 4 September 4th, 2004 07:19 PM
Syntax error (missing operator) in query expressio nidy_online Wrox Book Feedback 1 April 30th, 2004 06:40 PM
Syntax error (missing operator) in query expressio mvollmer Classic ASP Databases 7 December 5th, 2003 11:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.