Error: { "message": "sqlite3_prepare_v2 error: token \"876EL003\" not recognized", "code": 5}

I am having trouble filtering the SQLite data with two conditions. I keep getting an unrecognized token error and I suspect that my query statement might be incorrect in the script. Could you please take a look and see if you can help me out? Thank you! I have attempted two different ways to do this:

 getEquipmentByTagCode(equipTag,projCode){
    console.log("Equipment Param"+equipTag+projCode);
    return this.database.executeSql('SELECT * FROM equipmentInstall WHERE equipTag=('+equipTag+') AND projCode=('+projCode+') ', []);
  }

getEquipmentByTagCode(equipTag,projCode){
    console.log("Equipment Param"+equipTag+projCode);
    return this.database.executeSql('SELECT * FROM equipmentInstall WHERE equipTag IN ('+equipTag+') AND projCode IN ('+projCode+') ', []);
  }

Answer №1

The solution to the error has been found - it was caused by missing double quotes in the code snippet below:

getEquipmentByTagCode(equipTag, projCode) {
    console.log("Equipment Parameters: " + equipTag + ", " + projCode);
    return this.database.executeSql('SELECT * FROM equipmentInstall WHERE equipTag="' + equipTag + '" AND projCode="' + projCode + '" ', []);
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Determining TypeScript function attributes through inference

I am working on creating a customized form generator that is strongly typed, and I need to configure it with options based on the model. I'm wondering if it's possible to determine the return type of a function from its arguments in TypeScript, a ...

How can I detect a click event in Angular using Typescript?

I am looking to transform the provided jquery scripts into typescript code. Jquery $(".room").click({ console.log("clicked"); }); TypeScript import { Component } from '@angular/core'; declare var $: any; export class AppComponent { } ...

Intellisense in VS Code is failing to provide assistance for data within Vue single file components

I am working with a simple code snippet like this https://i.sstatic.net/JSEWJ.png However, within the method, the variable 'name' is being recognized as type any. Interestingly, when I hover over 'name' in the data, it shows up as a s ...

The function for utilizing useState with a callback is throwing an error stating "Type does not have

Currently, I am implementing the use of useState with a callback function: interface Props { label: string; key: string; } const [state, setState] = useState<Props[]>([]); setState((prev: Props[]) => [...pr ...

Capturing page titles accurately for timeonsite tracker in a single-page Angular app is challenging when navigating to other pages

Implemented the timeonsite JS tracker in my Angular web application using HTML tags as shown below, <script type="text/javascript"> var Tos; (function(d, s, id, file) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementByI ...

Testing Angular Components with Jasmine and Karma: When handling the 'onChange' event, the changeEvent parameter of type MatRadioChange should not be void and must be assigned to a parameter of type

Hey there, I was working on a test for a call where I am using to emit the event: onChange(eventName: MatRadioChange): void { this.eventName.emit(eventName.value); } Here is the test I have written for it: describe('onChange', (eventName: ...

Executing a function within JSX to dismiss a modal in NextJS

I am currently utilizing the Tanstack React Query library to perform a POST request from a Modal that includes a form: const addDay = (day: TDay) => { const apiURL = process.env.NEXT_PUBLIC_SERVER_URL const queryURL = apiURL + router ...

Updating an object within an array of objects in Angular

Imagine having a unique object array named itemArray with two items inside; { "totalItems": 2, "items": [ { "id": 1, "name": "dog" }, { "id": 2, "name": "cat" }, ] } If you receive an updated result for on ...

Although there may be some issues with tslint, the functionality is operating smoothly

I am in the process of learning tslint and typescript. Currently, I am facing an issue that I need help with. Could you provide guidance on how to resolve it? Despite conducting some research, I have been unable to find a solution. The relevant code snippe ...

Experiencing an abundance of issues with html-webpack-plugin while incorporating TypeScript

I am working on a project that involves using Webpack and TypeScript. However, when attempting to run the development server, I encountered numerous errors related to the html-webpack-plugin. This is a snippet of the output: > [email protected] dev ...

Using Angular to parse intricate JSON data

Need help parsing an http request in the following format: [ { "id": 1, "date": "2022-01-13T00:00:00.000+00:00", "time": "2022-01-13T21:21:21.000+00:00", "office&quo ...

Instructions on enabling a search feature within a resolver using [nestjs/graphql]

Issue Hey everyone, I'm having trouble with implementing a search resolver. The resolver search is supposed to take a query as a parameter and then use the useSearch function to retrieve data. However, I keep getting an error, which is displayed at t ...

extracting the value of an option from a form control to utilize in the component's model

I'm currently facing an issue where I am unable to retrieve the value of an option selection in my component class for further processing. Despite setting the value as [value]="unit" in the view, it still shows up as undefined when passed through onMo ...

Encountering the error message "String length is invalid" during the execution of ng build for a library

While working with Angular and attempting to build a large library using the command ng build <project>, we encountered the following issue: ❌ Generating "fesm2015" Invalid string length The build for fesm2020 was successful, but the sourcem ...

Generate a user with unique UUID identifier and an array of nested objects

When using GraphQL, React, and Prisma, I encountered a challenge in creating a user with a UUID as the ID and a nested object array containing all input data related to that user. My objective is to display all input data associated with a user in React. H ...

Run a function from an alternate element

I have successfully created a grid with a button that enables me to control a timer. When I click on the start button in the grid on the home page, the timer begins counting the time. By using a service, I am able to determine whether the timer is active ...

Retrieving data from an Angular 5 Input text field

I have been struggling with what seems like a simple question, but none of the solutions I found seem to work for me. In my component.html file, I have a standard input field: <div class="form-group"> <label>Serial</label> <in ...

Having trouble triggering a change event within a React component?

I'm working on a straightforward react-component that consists of a form. Within this form, the user can search for other users. To ensure the form is valid, there needs to be between 3 and 6 users added. To achieve this, I've included a hidden ...

Using asynchronous data in Angular 2 animations

Currently, I have developed a component that fetches a dataset of skills from my database. Each skill in the dataset contains a title and a percentage value. My objective is to set the initial width value of each div to 0% and then dynamically adjust it t ...

Sending common parameters to a React functional component within a TypeScript definition file

Currently, I am working on defining types in a .d.ts file for a React.FunctionComponent, specifically for a component called Tree with the following props: Tree.propTypes = { root: PropTypes.object.isRequired, children: PropTypes.func, top: PropType ...