score:0
Instead of concatenating string values in your sql commands, you should use Parametrized Queries.
See the following example:
function inputParameters() {
// Values contain variables idicated by '@' sign
const sql = `INSERT INTO ${table} (uniqueIdCol, intCol, nVarCharCol) VALUES (@uniqueIdVal, @intVal, @nVarCharVal)`;
const request = new Request(sql, (err, rowCount) => {
if (err) {
throw err;
}
console.log('rowCount: ', rowCount);
console.log('input parameters success!');
outputParameters();
});
// Setting values to the variables. Note: first argument matches name of variable above.
request.addParameter('uniqueIdVal', TYPES.UniqueIdentifier, 'ba46b824-487b-4e7d-8fb9-703acdf954e5');
request.addParameter('intVal', TYPES.Int, 435);
request.addParameter('nVarCharVal', TYPES.NVarChar, 'hello world');
connection.execSql(request);
}
Source: stackoverflow.com
Related Query
- Node.js query not inserting data into Azure SQL database
- node.js login not working with azure sql database
- Not able to use Supabase Hook to read data from database into react-table with react-query
- React Apollo first object from subscription not being merge into previous data it actually gets removed
- React Firestore data retrieval into array not working
- Redux Store does not update state with created data on firebase real-time database
- Why does graphql not inject my data into react component prop?
- Retrieving data sequentially from firebase database using async / await not working
- React Apollo Testing is not working. Query data is always coming undefined
- How can I Fetch and display Mysql data into ReactJS front end with Node JS as backend?
- Loading Data from MongoDB into Redux Store fetching from my node API
- React.js: Parent state values not passing into child properties + Fetch API data cannot be accessed
- testing fetch data query into component react
- I am trying to push data into array defined in useState in react, but the data is not being pushed in to array
- Data from my react front end not getting to mysql database
- search query does not display necessary data
- React Query return undefined data while in network tab the data exists but it does not show on the page
- React - Ajax data not being passed into Child Component
- React+Firebase: How to add item to list data into firebase realtime database
- Fetching documents in a subcollection of a cloud firestore database does not return any data
- React 'useContext' hook not re-rendering after context updates with database data
- React Typescript Router(5.1.8) data is not passing to other component as a query params
- Data from the backend is not appearing when you assign it into new object on the front end
- my data is not adding in to my firebase real time database
- Not able to convert response data into JSON
- After the login click i am not able to render the data that i got from Login form into the HomePage
- Gatsby + Markdown: GraphQL query renders as a component but not when imported into a page
- Data comes into console but does not show in application
- array object working if we hardcode data but not working when we populate data from Node js to react js
- Data not refreshing after adding entry to database React Router
More Query from same tag
- Tailwind css Grid is not working in Reactjs?
- how to implement the new react-redux v6.0.0
- How can I put a button into collapse?
- event bus in React?
- Same result on logging the state after render
- How to handle onKeyDown/Up opening the list items in React
- Zoom on chart not working in react-plotly.js
- Why axios remove "Bearer" string from authorization header?
- React FC Context & Provider Typescript Value Issues
- Infinity loops with useEffect and useCallback - Reactjs
- React, NextJS, Pusher multiple responses returned for every request
- How come in Postman my post request works but not in the browser even though I'm doing the same?
- ReactJS - How to allow user to type only integers
- React: Await useReducer dispatch before navigating away
- How do I mock a DataTransfer item for testing-library
- Array map is giving me an error when trying to call the data in a dynamic render operation
- Where to put component did mount in my next.js file
- React undefined props issue
- Flux + React: when to keep state of visual components at store
- React Memo still rerenders on state update
- TypeError: Super expression must either be null or a function, not undefined
- Is there a way to add more than one HTML element in a variable?
- TypeScript React onChanged: getting an error when trying to execute the web part in sharepoint
- useState variable not latest version in delete function, React
- How can I import multiple components from react-bootstrap?
- React - Access function parameters from parent to child
- ReactJS: access child method
- Child component non rerendering after setting state
- Typescript error when accessing children component despite using React.FC
- React : How to solve "System" is not defined