Syntax error missing operator in query expression

I have one select statement to execute on the access database on the click of a button. when i click on the button i am getting this error "Syntax error (missing operator) in query expression 'Customer_Name = Summer Terry'." The code that i have written is pasted below and also the error log. Can anyone please find and correct the error in my code.
  • Remove From My Forums
  • Question

  • I have one select statement to execute on the access database on the click of a button. when i click on the button i am getting this error «Syntax error (missing operator) in query expression ‘Customer_Name = Summer Terry’.» The code that
    i have written is pasted below and also the error log. Can anyone please find and correct the error in my code.

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.Data.OleDb;
    
    namespace Cyber_Application
    {
        public partial class RegularCustomer : Form
        {
            int flag = 0;
            string currentFile;
            string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\Clients\S V Cyber Cafe\Cyber Application\Cyber Application\param.accdb; Jet OLEDB:Database Password=12345";
    
            public RegularCustomer()
            {
                InitializeComponent();
            }
    
            private void btnOK_Click(object sender, EventArgs e)
            {
                string address = "";
                string date = "";
                string InTime = "";
                string OutTime = "";
                date = DateTime.Now.ToShortDateString();
                address = txtAddress.Text;
                InTime = txtInHour.Text + ":" + txtInMin.Text + " " + listBoxIn.SelectedItem.ToString();
                OutTime = txtOutHour.Text + ":" + txtOutMin.Text + " " + listBoxOut.SelectedItem.ToString();
                MessageBox.Show("Your address is:n" + address + "nToday's date is:n" + date + "nYour In Time is:n" + InTime + "nYour Out Time is:n" + OutTime);
            }
    
            private void btnCancel_Click(object sender, EventArgs e)
            {
                this.Close();
            }
    
            private void addCustomers()
            {
                OleDbConnection cn = new OleDbConnection(connectionString);
                OleDbCommand cmd = new OleDbCommand("select Customer_Name from Customers", cn);
                cn.Open();
                OleDbDataReader dr = cmd.ExecuteReader();
    
                if (dr != null)
                {
                    while (dr.Read())
                    {
                        cBoxCustomers.Items.Add(dr["Customer_Name"]);
                    }
                }
                cBoxCustomers.SelectedIndex = 0;
            }
    
            private void RegularCustomer_Load(object sender, EventArgs e)
            {
                addCustomers();
                btnOK.Enabled = false;
                btnBrowse.Enabled = false;
                btnSelectCustomer.Enabled = false;
                txtName.Enabled = false;
                txtAddress.Enabled = false;
                txtContactNo.Enabled = false;
                txtIdProof.Enabled = false;
                txtIssuedBy.Enabled = false;
            }
    
            private void cBoxCustomers_SelectedIndexChanged(object sender, EventArgs e)
            {
                if (cBoxCustomers.SelectedIndex == 0)
                {
                    btnSelectCustomer.Enabled = false;
                }
                else
                {
                    btnSelectCustomer.Enabled = true;
                }
            }
    
            private void btnSelectCustomer_Click(object sender, EventArgs e)
            {
                using (OleDbConnection cn = new OleDbConnection(connectionString))
                {
                    cn.Open();
                    string scmd = "select [Customer_Name], [Address], [Contact_No], [Gender], [Issued_By] from Regular_Customers where Customer_Name = " + cBoxCustomers.SelectedItem.ToString();
                    OleDbCommand cmd = new OleDbCommand(scmd, cn);
                    OleDbDataReader sdr = cmd.ExecuteReader();
                    while (sdr.Read())
                    {
                        txtName.Text = sdr[0].ToString(); ;
                        txtAddress.Text = sdr[1].ToString();
                        txtContactNo.Text = sdr[2].ToString();
                        
                        if (sdr[3].ToString() == "M")
                        {
                            radioBtnMale.Select();
                        }
    
                        if (sdr[3].ToString() == "F")
                        {
                            radioBtnFemale.Select();
                        }
    
                        txtIssuedBy.Text = sdr[4].ToString();
                    }
                }
            }
        }
    }
    
    

    The error code is:

    System.Data.OleDb.OleDbException was unhandled
      Message=Syntax error (missing operator) in query expression 'Customer_Name = Summer Terry'.
      Source=Microsoft Office Access Database Engine
      ErrorCode=-2147217900
      StackTrace:
           at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
           at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
           at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
           at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
           at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
           at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
           at System.Data.OleDb.OleDbCommand.ExecuteReader()
           at Cyber_Application.RegularCustomer.btnSelectCustomer_Click(Object sender, EventArgs e) in E:ClientsS V Cyber CafeCyber ApplicationCyber ApplicationRegularCustomer.cs:line 90
           at System.Windows.Forms.Control.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
           at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ButtonBase.WndProc(Message& m)
           at System.Windows.Forms.Button.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.Run(Form mainForm)
           at Cyber_Application.Program.Main() in E:ClientsS V Cyber CafeCyber ApplicationCyber ApplicationProgram.cs:line 17
           at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException: 
    
    

    • Edited by

      Monday, September 26, 2011 3:30 AM

Answers

  • Instead of concatinating a string command, you would be better off using parameters.  I’m doing inserts into Access, but the code below should give you a general idea, of how to use parameters.  Then you don’t need to worry if you have all the
    single quotes in the correct places.

                        using (dal.DBManager db = new dal.DBManager(dal.DataProvider.OleDb,
                            string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0}{1};",
                            this.db_Directory, this.db_FileName)))
                        {
                            db.Open();
    
                            foreach (DataRow row in dt.Rows)
                            {
                                this.CurCount++;
                                this.TotalCount = (short)(((float)this.CurCount / (float)dt.Rows.Count) * 100);
                                this.StatusMessage = string.Format(Msg, this.CurCount, dt.Rows.Count.ToString(), this.TotalCount.ToString());
    
                                db.Command.CommandText = "INSERT INTO [ProgramLanguage Join](ProgramID, LanguageID, AudioFormatID) VALUES(?, ?, ?)";
    
                                db.CreateParameters(3);
    
                                db.AddParameters(0, "ProgramID", Convert.ToInt32(row["ProgramID"]));
                                db.AddParameters(1, "LanguageID", Convert.ToInt16(row["LanguageID"]));
                                db.AddParameters(2, "AudioFormatID", Convert.ToInt16(row["AudioFormatID"]));
    
                                db.ExecuteNonQuery(CommandType.Text, db.Command.CommandText);
    
                                worker.ReportProgress(this.TotalCount, StatusMessage);
                            }
    
                            db.Close();
                        }
    
    • Marked as answer by
      Martin_Xie
      Thursday, September 29, 2011 5:29 AM

  • enclose the value that you would like to pass with ( ‘ )… as in your code:

     « + cBoxCustomers.SelectedItem.ToString();

    should be: ‘« + cBoxCustomers.SelectedItem.ToString() +
    ««;

    • Edited by
      RoninB
      Monday, September 26, 2011 3:38 AM
    • Marked as answer by
      tapan.desai
      Monday, September 26, 2011 6:17 AM

  • hi Tapan,

    please try this:

    string scmd = "select [Customer_Name], [Address], [Contact_No], [Gender], [Issued_By] from Regular_Customers where Customer_Name = '" + cBoxCustomers.SelectedItem.ToString()+"'";
    
    

    Regards, http://shwetamannjain.blogspot.com

    • Proposed as answer by
      Shweta Jain (Lodha)
      Monday, September 26, 2011 3:41 AM
    • Marked as answer by
      tapan.desai
      Monday, September 26, 2011 6:17 AM

Be The First To Get Support Updates

Want to know about the latest technical content and software updates?

Error Message

This message is returned during Interactive Selection on Access GeoDatabase:

There was an error executing the query.
General Function Failure [1layer_name]
Syntax error (missing operator) in query expression ‘(1layer_name.OBJECTID = 1layer_name_Shape_Index.IndexedObjectId and MaxGx >= 2 and MinGX <= 2 and MaxGY> = 0 and MinGY <= 0)’.

Cause

Personal Geodatabase Access layer features cannot be selected if the name of the layer starts with a number.

Note:
Database management systems have different definitions of acceptable characters for object names. Most names must begin with a letter and cannot contain spaces, backslashes, or reserved database management system keywords. Some databases allow special characters such as forward slashes (/), underscores (_), dollar signs ($), dashes (-), dots (.), or mixed cases. Sometimes the database allows you to use special characters or reserved keywords, or force mixed, upper-, or lowercase names if you provide the object name enclosed in delimiters, such as double quotation marks.

However, ArcGIS does not delimit object names. Do not create any tables, feature classes, indexes, databases, users*, roles, or other object names that require delimiters if you will be using them with ArcGIS. The object will be created in the database, but you cannot access it from ArcGIS.

*SQL Server user names containing special characters are delimited to fully support Active Directory Groups and Windows Authenticated logins; however, ArcGIS does not support user names containing single quotation marks or apostrophes.

Solution or Workaround

Rename the Feature layer to not begin with a number.

Related Information

  • What is a personal geodatabase?

Last Published: 7/9/2019

Article ID: 000002818

Shaman_64

1 / 1 / 0

Регистрация: 18.11.2017

Сообщений: 57

1

26.10.2021, 16:14. Показов 1652. Ответов 9

Метки нет (Все метки)


Всем здравствуйте!
Столкнулся с проблемой «Syntax error (missing operator) in query expression ‘375(25)849-80-76’.»
при вводе данных в базу через форму.

C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
private void Add_Personal(string surname, string name, string m_name, string post, string phone, string establ, string salary )
        {
            string CommandText;
            //string s_phone;
 
           // s_phone = Convert.ToString(phone); // переводим phone из double в строку
 
            CommandText = "INSERT INTO Personal ([Фамилия], [Имя], [Отчество], [Должность], [Телефон], [Код заведения], [Ставка])"
            + " VALUES ('" + surname + "', '" + name + "', '" + m_name + "', '" + post + "', "+ phone + ", " + establ + ", '" + salary + "')";
            My_Execute_Non_Query(CommandText);
        }
 
        private void Button9_Click(object sender, EventArgs e)
        {
            if (act_table == 1) // обрабатываем таблицу "Establishments"
            {
                Form2 f = new Form2();
 
                if (f.ShowDialog() == DialogResult.OK)
                {
                    // добавляем данные в таблицу "Establishments"
                    Add_Establishments(f.textBox1.Text, f.textBox2.Text, f.textBox3.Text);
                    Get_Establishments();
                }
            }
 
            else
                if (act_table == 2) // обрабатываем таблицу "Personal"
            {
                Form3 f = new Form3();
                if (f.ShowDialog() == DialogResult.OK)
                {
                    // добавляем данные в таблицу "Personal"
                    Add_Personal(f.textBox1.Text, f.textBox2.Text, f.textBox3.Text, f.textBox4.Text, f.textBox5.Text, f.textBox6.Text, f.textBox7.Text);
                    Get_Personal();
                }
            }
        }

поле в базе данных тип короткий текст, если в форму ввожу номер без скобок и дефисов, то все работает, а вот в формате 375(25)849-80-76 выдает указанную выше ошибку. Надеюсь объяснил понятно. Жду вашей помощи.

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Эксперт .NET

16930 / 12507 / 3286

Регистрация: 17.09.2011

Сообщений: 20,745

26.10.2021, 16:28

2

Shaman_64, используйте параметризованные запросы вместо склеивания строк.
Заодно почитайте про SQL-инъекции, чтобы знать почему как у вас делать не стоит.

Ну и я не знаю чей телефон вы сейчас засветили на весь Интернет, но может не надо?



0



1 / 1 / 0

Регистрация: 18.11.2017

Сообщений: 57

26.10.2021, 17:00

 [ТС]

3

Цитата
Сообщение от kolorotur
Посмотреть сообщение

Shaman_64, используйте параметризованные запросы вместо склеивания строк.
Заодно почитайте про SQL-инъекции, чтобы знать почему как у вас делать не стоит.

Ну и я не знаю чей телефон вы сейчас засветили на весь Интернет, но может не надо?

Это сгенерированный программой номер телефона и реально такого номера нет



0



294 / 118 / 33

Регистрация: 06.03.2016

Сообщений: 453

26.10.2021, 19:45

4

Shaman_64, сути не меняет. Параметры надо передавать параметрами (гениально…), а не пихать в строку.
Но даже без этого видно, что phone строка string phone, а передается как число "', "+ phone + ", ", т.к. не в '



0



Shaman_64

1 / 1 / 0

Регистрация: 18.11.2017

Сообщений: 57

28.10.2021, 12:23

 [ТС]

5

Да,спасибо, с этим понятно. Вы уж не судите строго, это курсовая и мне не важно если код кривоват, я только учусь а через две недели надо сдать.

Добавлено через 3 минуты
Возникла другая проблема и не могу понять, вроде все правильно, но выдает ошибку System.Data.OleDb.OleDbException: «The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.»
Не пинайте пожалуйста, а подскажите в чем может быть проблема

C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
 
namespace Сеть_ресторанов
{
    public partial class Form1 : Form
    {
        public string ConnectionString = "Provider = Microsoft.ACE.OLEDB.12.0;" +
            "Data Source = C:\Users\Intel\Desktop\4 Курс\БД и СУБД\Проект_1\Сеть ресторанов\DataBase\BazaRestoranov.accdb";
        private int act_table = 1; // активная таблица (1-рестораны, 2-сотрудники, 3-разделы, 4-меню)
        public Form1()
        {
            InitializeComponent();
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
            comboBox1.SelectedIndex = 0;
            Button1_Click(sender, e);
        }
 
        private void Button1_Click(object sender, EventArgs e)
        {
            string CommandText = "SELECT " +
              "[Заказы].[ID_Zakaza], " +
               "[Рестораны].[Название], " +
               "[Сотрудники].[Ф_И_О], " +
               "[Разделы].[Название], " +
               "[Блюда].[Наименование], " +
               "[Блюда].[Цена], " +
 
              "FROM " +
              "[Заказы], " +
               "[Рестораны], " +
               "[Сотрудники], " +
               "[Разделы] " +
               "[Блюда] " +
              "WHERE " +
                "([Заказы].[ID_Zakaza]=[Заказы].[ID_Zakaza]) AND " +
                "([Заказы].[ID_Restorana] = [Рестораны].[ID_Restorana]) AND " +
                "([Заказы].[ID_Sotrudnika] = [Сотрудники].[ID_Sotrudnika]) AND " +
                "([Заказы].[ID_Razdela] = [Разделы].[ID_Razdela]) AND " +
                "([Заказы].[ID_Blyuda] = [Блюда].[ID_Blyuda]) AND " +
                "([Заказы].[ID_Blyuda] = [Блюда].[Цена])"; 
        
 
            if (textBox1.Text != "")  // если набран текст в поле фильтра
            {
                if (comboBox1.SelectedIndex == 0)
                    CommandText = CommandText + " AND ([Заказы].[ID_Zakaza] = '" + textBox1.Text + "')";
                if (comboBox1.SelectedIndex == 1) // Рестораны
                    CommandText = CommandText + " AND (Рестораны.[Название] LIKE '" + textBox1.Text + "%') ";
                if (comboBox1.SelectedIndex == 2) // Сотрудники
                    CommandText = CommandText + " AND (Сотрудники.[Ф_И_О] LIKE '" + textBox1.Text + "%') ";
                if (comboBox1.SelectedIndex == 3) // Разделы
                    CommandText = CommandText + " AND ([Разделы].[Название] LIKE '" + textBox1.Text + "%') ";
                if (comboBox1.SelectedIndex == 4) // Блюда
                    CommandText = CommandText + " AND ([Блюда].[Наименование] LIKE '" + textBox1.Text + "%') ";
                if (comboBox1.SelectedIndex == 4) // Блюда
                    CommandText = CommandText + " AND ([Блюда].[Цена] LIKE '" + textBox1.Text + "%') ";
            }
 
            OleDbDataAdapter dataAdapter = new OleDbDataAdapter(CommandText, ConnectionString);
            DataSet ds = new DataSet();
            dataAdapter.Fill(ds, "[Заказы]");
            dataGridView1.DataSource = ds.Tables["[Заказы]"].DefaultView;
 
 
        }
 
        private void Button2_Click(object sender, EventArgs e)
        {
           
        }
 
        // выполнение SQL-запроса для команд INSERT, UPDATE, DELETE
        public void My_Execute_Non_Query(string CommandText)
        {
            OleDbConnection conn = new OleDbConnection(ConnectionString);
            conn.Open();
            OleDbCommand myCommand = conn.CreateCommand();
            myCommand.CommandText = CommandText;
            myCommand.ExecuteNonQuery();
            conn.Close();
        }



0



796 / 579 / 207

Регистрация: 21.02.2019

Сообщений: 2,095

28.10.2021, 12:30

6

Shaman_64,
.. с запятыми разберитесь … в SELECT она лишняя после [Блюда].[Цена] .. а в FROM отсутствует после [Разделы] …



0



1 / 1 / 0

Регистрация: 18.11.2017

Сообщений: 57

28.10.2021, 13:09

 [ТС]

7

С запятыми разобрался, теперь появилась другая ошибка System.Data.OleDb.OleDbException: «Отсутствует значение для одного или нескольких требуемых параметров.»



0



294 / 118 / 33

Регистрация: 06.03.2016

Сообщений: 453

28.10.2021, 13:14

8

Цитата
Сообщение от Shaman_64
Посмотреть сообщение

Не пинайте пожалуйста, а подскажите в чем может быть проблема

Качаете SSMS. Пишете там свои запросы, исправляете на правильные, потом переносите в код.

Добавлено через 3 минуты

Цитата
Сообщение от Shaman_64
Посмотреть сообщение

С запятыми разобрался, теперь появилась другая ошибка System.Data.OleDb.OleDbException: «Отсутствует значение для одного или нескольких требуемых параметров.»

Сделайте уже по-человечески. По соседству тем полно, где показано как параметрами передавать. Тогда не будет таких бестолковых ошибок, потому что сами уже запутались где что.



0



1 / 1 / 0

Регистрация: 18.11.2017

Сообщений: 57

28.10.2021, 13:15

 [ТС]

9

Вопрос как им пользоваться, да и база у меня на ACCESS



0



ipsorokin

294 / 118 / 33

Регистрация: 06.03.2016

Сообщений: 453

28.10.2021, 13:28

10

Цитата
Сообщение от Shaman_64
Посмотреть сообщение

Вопрос как им пользоваться, да и база у меня на ACCESS

Да без разницы какая база. Говорю же тем полно тут. Отличие только в том, что будет использоваться OleDb***** и параметры должны добавляться в порядке их следования в запросе. В самом запросе вместо них ставятся ?
Вот пример.

C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
            try
            {
                using OleDbCommand command = new("INSERT INTO IdentityUsers (Id, UserName, Email, PasswordHash, LastName, FirstName, PhoneNumber) VALUES (?, ?, ?, ?, ?, ?, ?)", con);
                command.Parameters.AddWithValue("id", Guid.NewGuid().ToString());
                command.Parameters.AddWithValue("username", user.UserName);
                command.Parameters.AddWithValue("email", user.Email);
                command.Parameters.AddWithValue("pwdh", HashPassword(password));
                command.Parameters.AddWithValue("lname", user.LastName);
                command.Parameters.AddWithValue("fname", user.FirstName);
                command.Parameters.AddWithValue("phone", user.PhoneNumber);
                con.Open();
                command.ExecuteNonQuery();
            }
            finally
            {
                con.Close();
            }



0



I have an Access front end with a SQL backend. I’m trying to add a couple of fields to a form. When I edit the working SQL statement for the Form_Open event and add the LEFT JOIN table I get the following error:

There has been an error.
3075: Syntax error (missing operator) in query expression ‘CS.[SegmentID] = S.[SegmentID] LEFT JOIN DATR_ContractEnviroFee AS CEF ON C.[ContractID] = CEF.[ContractID’.
Source: DAO.Database
Form_InitialFeeHelper.Form_Open

SQL Statement:

    Set rst = db.OpenRecordset( _
    «SELECT TotalNewSignFee AS NewInstall, OnContactCompanyId, ContractEntryID, » & _
    «TotalMonthlyFee AS MonthlyFee, CEF.EnviroFee AS EnviroFeeAmt, CEF.Comment AS EnviroComment » & _
    «NoEnviroFee As EnviroFee, Sponsor, TotalInitialFee AS InitialFee, » & _
    «S.SegmentCode AS SegmentID, S.RouteName AS ROUTE, C.TotalInitialFeeBilled AS InitialFeeBilled, » & _
    «S.DirectionCode AS DIRECTION, S.City AS CITY, S.StateCode, C.AssignedRep AS Rep, » & _
    «C.[Free01] AS [Free01], C.[Free24] AS [Free24], C.[Free25] AS [Free25], C.[Disc01] AS [Disc01], » & _
    «C.[DiscSF] AS [DiscSF], C.[DiscMF] AS [DiscMF], C.[FreeMonth01] AS [FreeMonth01], » & _
    «C.[FreeMonth24] AS [FreeMonth24], C.[GiftCard] AS [GiftCard],» & _
    «C.[FreeMonth25] AS [FreeMonth25], C.[Discount01] AS [Discount01], C.[DiscountSignFee] AS [DiscountSignFee], » & _
    «C.[DiscountMoFee] AS [DiscountMoFee], C.[GiftCardAmount] AS [GiftCardAmount],» & _
    «C.[FreeMonth01_Processed] AS [FreeMonth01_Processed], » & _
    «C.[FreeMonth24_Processed] AS [FreeMonth24_Processed], C.[FreeMonth25_Processed] AS [FreeMonth25_Processed], » & _
    «C.[Discount01_Processed] AS [Discount01_Processed], C.[DiscountSignFee_Processed] AS [DiscountSignFee_Processed], » & _
    «C.[DiscountMoFee_Processed] AS [DiscountMoFee_Processed], C.[GiftCard_Processed] AS [GiftCard_Processed] » & _
    «FROM (DATR_Contract AS C INNER JOIN DATR_ContractSegment AS CS ON C.ContractID = CS.ContractID) » & _
    «INNER JOIN DAT_Segment AS S ON CS.[SegmentID] = S.[SegmentID] » & _
    «LEFT JOIN DATR_ContractEnviroFee AS CEF ON C.[ContractID] = CEF.[ContractID] » & _
    «WHERE C.ContractID = » & conId, dbOpenDynaset, dbSeeChanges)

Again, the statement was working fine until I tried to add the DATR_ContractEnviroFee table into the mix.

Понравилась статья? Поделить с друзьями:
  • Syntax error json parse error
  • Syntax error invalid syntax перевод
  • Syntax error unexpected token laravel
  • Syntax error invalid syntax string
  • Syntax error unexpected token joomla