Skip to content
Advertisement

Tag: c#

Method returns a value but the property does not hold it

The method LocalizaArquivo() calls the method VerificaArquivoCarregado() that checks if the file is already loaded. If it is loaded returns arquivoCarregado = true. When I debug it, I can see that arquivoCarregado = true, but after the method VerificaArquivoCarregado() is finished it changes to false. The property “public bool arquivoCarregado { get; set; }” does not mantain the status. Why

Linq Find the most recurring record

I have a rent a car project. This is the table where I keep the rented vehicles I want to find the most rented vehicle in this table. How can I do this? So I want to find the most mentioned car Id in the table [I have to do it with context architecture. How can I do this with

Can’t find MySql.Data.MySqlClient.MySqlException insert query error

This is the error message MySql.Data.MySqlClient.MySqlException: ‘You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ””)’ at line 1′ this is my query I’ve been looking over at it for over an hour now and I still get this error. Answer It is recommended

Why am I getting insufficient parameters supplied to the command error?

I have trying to read a database and display it into a datagridview, but I keep getting the error, using Windows Forms and SQLite: That’s the code I’m using, but what is the issue? I have tried removing the concatenation, and I’ve tried changing the parameters method too: I tried with and without the executenonquery() each time. Answer I have

SQL Multiple queries at the same time creating deadlock (UPDLOCK)

So I have a problem with my database giving me a deadlock. System.Data.SqlClient.SqlException : Transaction (Process ID 57) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. I have a project that starts to run and then splits into x amounts of instances that run parallel (usually between 4 and

Passing integer value from textbox in SQL select statement

I have an integer in a textbox(Integer retrieved from another form using TOstring) I want to use in an sql select statement. For example, select * from table where column = textbox. The problem is, npgsql gives an error saying I’m trying to pass string into integer column. I try to cast(::int) but still got errors. Any ideas! Answer I

Calculate time in List without using a loop

Is there a way to calculate the data on my List without using loop? My concern right now is it takes longer to process the 5000 ids of employee with different LogIn and LogOut using for loop in a week. What i’ve done is the data is uploaded from csv to the database. Once all the data is uploaded i

CosmosDB count using OrderBy multiple conditions

I am using Azure CosmosDB, the model contains Id, and creationTime properties. What I am trying to do is count entries within time interval. I looked how to achieve it using LINQ but could not find a solution. What I used than is SQL. This is what I tried: Bare in mind the values i showed are for display purposes.

Advertisement