I have the following query: The problem is that I make the property ProjeAdı in the Select clause. I want the property to match the sql column, Proje Adı (note the space). How can I do that? Answer aliases cant have spaces between them , just like any variable name cant have white space, they are considered a…
Tag: c#
An expression of non-boolean type specified in a context where a condition is expected, near ‘GROUP’
Hi guys I keep getting this error and I can’t figure it out. It works when I run the query in the database tool but not when it’s in my Microsoft web dev. The error i get is: An expression of non-boolean type specified in a context where a condition is expected, near ‘GROUP’. Code: Tha…
How to retrieve multiple column from SQL database?
I’m trying to get two column details like this way: public string GetData() { using (SqlConnection con = new SqlConnection(this.Connection)) { con.Open(); …
MS access Data type mismatch in criteria expression c#
I have error, i want to do a filter, which consist some combobox and datetimepicker and it’s will be show in dategridview. And when i want select date from datebase, i have this error: “Data type …
SqlCommand only returns one row
Trying to only return the first few number of rows because my database was too big, however when I was testing my SQL, I did a select * and was only returned the first row. What is wrong with my solution? Answer In your loop you constantly re-create the instance of the variable logs thus overwriting the previ…
How to keep DropDownList1 selected value after postback?
I have two DropDownLists. Once a DropDownList1 value is selected, DropDownList2 will populate based on Dropdownlist1. But after the page refreshes, the dropdownlist1 selected value is changed to the …
Can’t delete a row using entity framework
The problem that I’m having is that I can’t delete a row when using entity. I’m able to find the row, but the error I get the next error: Additional information: Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted si…
how to get the ID of the record that is update in C#
I am able to get a sql query that can return the ID of a record that is update in the Database; that ID is needed to update other records. but I don’t know how to get that updated ID value in C#. Answer I think you’re really asking how do you retrieve the resultset returned by an INSERT or
Dumping SQL table to .csv C#
I am trying to implement a script in my application that will dump the entire contents (for now, but I am trying to write the code so that I can easily customize it to only grab certain columns) of a sql db (running ms sql server express 2014) to a .csv file. Here is the code I have written currently:
Retrieving SQL Generated by Entity Framework Core
I’m trying to retrieve the raw SQL generated by Entity Framework for the following LINQ query: pagedItemResults = from firstItem in dbData.Accession join secondItem in …