I am trying to optimise my query to get data from database, so I would to know how can I directly run a sql query in my C#.
Currently I am using Entity framework with EDMX, so to improve query time, I would like to know how can I run direct sql query?
...I am trying to add List.GroupBy(a=>a.ProductType.Name).Select(a=>a.FirstOrDefault())
, now here I can have null values for .ProductType or .name so how can I ignore null values in C#, so I can get proper results of GroupBy?
If I am using above query in C#, I am getting error
Object reference not set to an instance of an object
I tried to make it like List.GroupBy(a=>a.ProductType != null ? a.ProductType)
, but it doesn't work.
Hello, I would like to create a helper function in the class, which can be used by multiple List types at the same, so how can I create initialize or create function to pass List<T>
where T
can be any type of class in C#?
I wanted to remove double quotes from a string using C#, How can I do that easily and efficiently?
For Example, I have string : "-10,20", how to get output -> -10,20
...
Hello, I would like to know, How can I convert a positive number ( int type) to a negative number in C# and vice-versa ( negative to positive number using C#)?
...
I would like to know, how can I delete a file, after checking if it exists on the hard disk, if yes, then delete it, using C# in asp.net?
Thanks
...Hello
based on this
I create my data and I store them in a datatable.
Now I have another datatable which I fill it from my database.
I need to remove the duplicates from the first datatable and fill a datagridview.
This is what I have so far
...I am using LogParser tool (MSUtil dll) to insert data in db through SSIS Package.
I am using following code in script task component:
Looping through log files and using following :
...