I am trying to get my program to work, it is using parameters in an SQL query to add it to the database. When I run the program it comes up with “datetime conversion failed when converting date or time from character string”. I have tried many types of coding to make it work and all have failed. T…
Tag: c#
How do I convert this SQL into LINQ?
How Do I convert this sql query: select * from Trades where tradestatus = 1 and tradetype = 1 and maturitydate < GETDATE() and referenceId not in (select referenceid from Trades where tradetype = 2)…
How to convert SQL query to Linq in Entity Framework 6?
How can I convert this SQL query to a linq expression? Select distinct Clients.Id From Clients Join Orders On Clients.Id = Orders.ClientsId and Orders.Date < DATEADD(DD, -Clients.Term, CAST(…
SQLITE: Return 5 most recent records today and format date/time
I have a Xamarin.Forms app which has a ListView. I would like to populate the ListView with the 5 most recent items where the date is today’s date. If there are less than 5 items, the ListView should only display a row for each item (for example, if there is only one item, the ListView should only have …
LINQ double INNER JOIN on query translation when using selectMany
I have the following LINQ statement: Which uses the repository pattern. The search function is the one below: When I inspect the command that arrives in SQL Server I see that the query is translated in the following SQL: It works perfectly, but why there is an inner join duplicated: is a non-sense to me! If I…
Adding text and image to database with C# and SQL
The following windows form application takes an input for name, age, gender, description, and an image. However when clicking the “Save Information” button the following exception error …
Getting Error as @Parameter1 is not a parameter for procedure
I am learning mvc from this video where I am getting data from a form and saving it to database. When I ran my code first it gave an error stating Procedure or function ‘spAddEmployee’ expects parameter ‘@Employee_Name’, which was not supplied. I followed a solution in which I initiali…
Sqlite Query to remove duplicates from one column. Removal depends on the second column
Please have a look at the following data example: In this table, I have multiple columns. There is no PRIMARY KEY, as per the image I attached, there are a few duplicates in STK_CODE. Depending on the (min) column, I want to remove duplicate rows. According to the image, one stk_code has three different rows.…
Increasing the number of ids in the TextBox by one
I have a table in my Sql Server and I have a value in this table. Table name = veriler Values name= Project ID int(PRIMARY KEY) I’m doing project automation for electrical engineer’s project. If engineer click the new project button. My program redirect to the Genel.aspx page. When the new project…
I get an error “Error converting data type nvarchar to real.”
The code which I have is below, can you please inform me where the issue might be so we can drop the price by warehouse ID with 7%? Answer As you are not assigning any value to @Price in the C# code while your Warehouse Id and the Discount rate are subject to be assigned by the end-user, I recommend