I have the data below in a sql table, let assume the user wants to get data of 2020-11-13 which is but i’d like to get the previous supplier due as well before the date specified which is along with so the actual query i wanna get is this and if there is no previous due i wanna return i
Tag: c#
Issues with Dapper query syntax
little assistance here with my query using dapper, been getting error Message = “ORA-00936: missing expressionn” on my query. I would like to know what am I missing here? Answer Firstly with Oracle queries you need to use : instead of @ to denote a parameter placeholder. Then secondly this code: will produce an object with a property called RouteId.
How to prevent MySql Injection in dynamic where?
I have an API in my C# WEBApi project which return some items from my MySQL DB. The data to return has a visibility set in a table and the params set in the API call says which kind of data should be …
Delete row in datagridview and database with C#
I made a database and a program with a datagridview to show the database content. Now I want to make a button to let users delete a row and delete it also in the database. I tried the following …
DataTable ‘Table’ already belongs to this DataSet – on a new DataSet?
I have a function that executes SQL queries and returns a generic DataSet of the query results. This function has been working for years in many applications, but today with a specific query I am getting “Error executing [select top (1) RecordId, SourceCID, SourceID, CaseID, DisposeRequestedDate, DisposeRequestedBy, DisposeApprovedDate, DisposeApprovedBy from mycatalog.dbo.CASD_RetentionManagementDisposalApprovedQueue order by DisposeApprovedDate, RecordID;] A DataTable named ‘Table’ already
Unexpected token when creating a string expression?
I have the following code: There is an error here ‘{cardId And it tells me Invalid Expression term ” Answer You need to be aware that this kind of string concatenation is avoided and it is open to SQL Injection attack, you should always use parameterized queries to avoid SQL Injection and also to get rid of errors, something like
How can I modify the value of an element of my gridview before update in database?
I have a gridview but I want to update a cell value before the update in the database but it doesn’t work In the .aspx file: In the .aspx.cs file: I try to update the row before insert in database with OnRowUpdating but it doesn’t change the value. Someone have any idea how to do it ? Answer I have
How can I group a joined query with linq
I’m trying to produce a data set for a graph that would get me the same result as the following SQL query: But if I try to translate it into a linq query, I can’t get the same result, I either don’t have access to one or the other side of the junction, or I get a yearly total of
C# INSERT to SQL method exception when DateTime parameter is null
One of my parameter looks like this: I know that User has null value in last_sign_in_at. Database accept nulls for this column but I get an exception: SqlException: The parameterized query ‘(@id int,@name nvarchar(18),@username nvarchar(11),@state nvarch’ expects the parameter ‘@last_sign_in_at’, which was not supplied. Answer You should be using DBNull.Value: Casting to object here is just for operator ?? to
How to Insert C# values to MySql?
I want to insert C# winform values to Mysql there are 3 columns name,id are TextBox text and gender is ComboBox value but there is error and error messsage said: MySql.Data.MySqlClient.MySqlException:…