I am using SqlKata to creating dynamic SQL queries. I have a list of conditions, stored in my database, which are generated according to my business rules. this is my code sample: var list = new List&…
Tag: .net
Firebird with .net driver – drop table if exists
I’m new to Firebird and I’m testing a few things to check out the differences between Fb and SQlite (and the .net driver). I am trying to do a drop table if exists followed by the creation of a table. In Sqlite I am able to do this by: However in Firebird the same query fails. I’ve read that this
How to get datasource from Connectionstring using PowerShell?
In .Net we can get the datasource from a connectionstring using below mechanism: I was trying to do that in PowerShell but getting the following exception: New-Object : Exception calling “.ctor” with “1” argument(s): “Keyword not supported: ‘metadata’.” At line:1 char:17 + $ConstringObj = New-Object System.Data.SqlClient.SqlConnectionStringBuilder($con … + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
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: Thanks in Advance for the
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:
Using SqlQuery<Dictionary> in Entity Framework 6
I’m trying to execute a SQL query in EF 6. The select query returns two string columns, e.g. select ‘a’, ‘b’, and can have any number of rows. I’d like to map the result to a dictionary, but I can’t …
How do you write a parameterized where-in raw sql query in Entity Framework
How do you write a parameterized where-in raw sql query in Entity Framework? I’ve tried the following: But as expected, it throws an error on DateParam because it’s expecting a single value. Answer This isn’t a problem specific to entity-framework, you can solve it by generating your own parameter names dynamically. The resulting query sent to SQL-Server will look like
C# SqlReader issue
I’am posting on this forum for the first time . and I really hope I can find some help . What I’am doing is load about … 1000 Value (example) from SQL and I’am doing it just fine . the query for example is : Select Value from DatabaseA.dbo.Values that “Value” ==> decimal(10, 2) this propably should work fine .
Sql Command Not Working
I wrote the following code, but nothing is being inserted into the database. I tried changing the SA password in the connection string to something incorrect and the code isn’t catching the exception. What am I doing wrong? Answer As stated by the OP in the comments. Once the try-catch was resolved it was discovered that it just a mismatched
SqlCommand INSERT INTO query does not execute
Hello guys I have got this code: It should insert data from textboxes: kname, ksurname, but it closes the form without showing them in MS SQL table klient Answer Missing the ExecuteNonQuery call A command should be executed to update the database…