Skip to content
Advertisement

Tag: c#

linq query to get possible combinations

I have table1 like funid reasonid 1 1 1 2 2 1 2 3 and users table(users will repeat) like below userid reasonid 10 1 10 2 11 1 12 3 13 1 13 3 how to write a query to get the users satisfying table 1 combination {1,2} and {1,3}, so as per the above data userid 10 and

Make custom Restriction NHibernate for QueryOver

I’m stuck in a simple problem, I’d like to add a new custom restriction in NHibernate. I want to write a simple QueryOver with a fulltext index, an example with a Projections is here How to use Full Text Search for any property with QueryOver API But I need a more flexibility so I’d like something like Is it possible?

Syntax error while doing C# SQL data insert

I am using the above code for data entry into SQLite database, but while getting some string values, I am getting this error: ‘SQL logic error near “da”: syntax error’ What is the reason ? Answer You will get SQL syntax error if one of rehberIsmi, jsonData contains single quote. In your case, composing SQL query by concatenating strings is

C# is adding 00:00:00 unnecessarily

My SQL Server is using the DATE datatype, but my C# app is reading this as ‘mm/dd/yyyy 00:00:00’, can anyone tell me how to get rid of the 0s? (everything else works)…? Answer If you don’t want the time portion of a DateTime as String you have several options: Read: Date and time format strings

How to Count from sql as a value in Npsql

I am using Npgsql to access postgresql database and I am running a query: The query will return value 4, but my a gets -1.what is the problem here and how can I solve it? Answer It looks like you are using Dapper. If so, you want QueryFirst not Execute, as Execute just returns the number of rows

How do I clear specific columns in DataGrid?

i am using WPF, connected to SQL DataBase via LinqToSql. I have filled DataGrid using ItemsSource. I would like to clear everything in my DataGrid, except first two rows(ID,first and second name), and Headers ofcourse, by pressing a button. All items i would like to(either set to null or 0) remove, are floats, but I can’t find the right logic

How to import values from csv to SqlServer using c#

I have come across this problem.I am trying to import data into a database from a csv file.Normally the insert part works,but now I keep getting an error: Arithmetic overflow error converting int to data type numeric . The statement has been terminated.It is probably because I have id as the first property,but if I “shift” the array by omitting

Advertisement