Categories
Mastering Development

Remove the time in Datagridview and when exported to PDF

Please help me guys! I want the time in Date_Purchased(date) to be removed in datagridview. Because whenever I exported the datagrid in PDF, it has the date and time in it. I only want the date and remove the time especially when exported to PDf. Here’s the sample piece of code. Public Sub NewInventory() Dim […]

Categories
Development

Add Item to Sub-Array in an array

I have an array vm.prdGroups = [{ type_id: ‘1’, group_name: ”, is_required: false, position: 0, options: { item_name: ”, item_price: ”, position: 0 } }]; How do I add a new array to the options key, to have something like this vm.prdGroups = [{ type_id: ‘1’, group_name: ”, is_required: false, position: 0, options: { item_name: […]

Categories
Development

How to get Name of an item corresponding to Min and Max value in a grouped set into different columns

Table 1: ORDERS (ORDER_ID, CUSTOMER_ID, ITEM_ID, QUANTITY) Table 2: CUSTOMERS (CUSTOMER_ID, CUSTOMER_NAME, ZIPCODE) Table 3: ITEMS (ITEM_ID, ITEM_NAME) Required Output: OUTPUT (ZIPCODE, MAX_ORDERED_ITEM_NAME, MIN_ORDERED_ITEM_NAME I’ve tried various approaches to get the output, but haven’t been able to get to the end result Current query: SELECT ZIPCODE, ITEM_NAME, SUM(QUANTITY) AS SALES FROM ORDERS JOIN CUSTOMERS ON […]

Categories
Development

Problems sending query results over TCP in a nodejs client/server

I’m trying to make a sort of middleman between my database and other node projects. I realize my code is probably garbage but I’m working on a uni project and have deadlines. Server code: const net = require(‘net’); const port = 7070; const host = ‘127.0.0.1’; const mariadb = require(‘mariadb/callback’) const conn = mariadb.createConnection({ host: […]

Categories
AJAX Development

remove quotation mark in ajax response

the response comes back as “4” instead of just 4 I tried changing it to .done(function(data)) but still has the same result $.ajax({ url: “../api/ajax/addToCart.php”, type: “post”, data: data }) .done(function(response) { // alert(response); $(‘#cart_counter’).html(response); // console.log(JSON.parse(response)); getCart(); // console.log(response); }); the ajax is taking the response from this page addToCart.php $sql1 = ‘DELETE FROM […]

Categories
Development

Converting 200+ rows to column in SQL Server using PIVOT

I have done some research and so far, this one makes sense to me: Convert row value in to column in SQL server (PIVOT) However, I am wondering if there is any way to do this without having to declare the needed columns one by one, as I have more than 200 columns to retrieve. […]