Skip to main content

Questions tagged [sqlcommand]

Represents a Transact-SQL statement or stored procedure to execute against a SQL Server database which is used in Microsoft .NET.

sqlcommand
0 votes
0 answers
49 views

Sanitising or Parameterisation of table name and columns in a SqlCommand [duplicate]

I am looking to build an internal tool that allows the generation of data in a database from a GUI, of course with a parameterised query if the tables and columns are known beforehand, this is no ...
jordan t's user avatar
  • 156
0 votes
0 answers
72 views

'The SelectCommand property has not been initialized before calling 'Fill'. ' error

I'm trying to have a DataGridView in my Windows Forms showing data from the database, but it doesn't want to run. namespace DentalClinicManagementSystem { class MyPatient { public void ...
CatD's user avatar
  • 1
0 votes
0 answers
32 views

SSIS Deployment Error: DataReader Issue When Executing Truncate Table SQL Command Task from SSISDB in SQL Server

I have a package containing a SQL Command task that truncates a table in SQL Server. When I executed it in the Visual Studio platform, the execution was successful. However, upon deployment and ...
C-El's user avatar
  • 1
0 votes
0 answers
135 views

C# Unit Test : How can I mock Database GetDbConnection() CreateCommand?

I've set up a mock database that works well - allowing me to test IF Statements below BUT line 55 calls a method that ultimately uses SQL to retrieve data from a database. So when the test progresses ...
ELJ's user avatar
  • 1
-1 votes
1 answer
221 views

Dapper convert DbNull to empty string

I am refactoring some code that used reflection to map a SqlCommand to a model. The new code uses the Dapper framework and works perfectly fine: Public Shared Function GetModel(Of T As New)(cmd As ...
Vincent's user avatar
  • 2,093
1 vote
1 answer
323 views

How to show the backslash commands in PostgreSQL?

With \help or \h below, I could show the SQL commands as shown below: \help Or: \h postgres=# \help Available help: ABORT CREATE USER ALTER AGGREGATE ...
Super Kai - Kazuya Ito's user avatar
1 vote
1 answer
60 views

Chapter 4 case project

Create a view named HighBalance using the the patient number, last name, first name, street, city and zip code for those patients with a balance greater than $1,000. Display the data in the view Im ...
Skeeball 1987's user avatar
0 votes
1 answer
79 views

Getting values from C# SqlDataReader into an integer variable

I am using SqlCommand to run a simple query against my database: SELECT MIN(ID), MAX(ID) FROM DocumentImage Obviously the query should return one row with two columns a minID (1) and a maxID (...
BenStark's user avatar
0 votes
0 answers
99 views

C# Additional String Validation For .text

I'm trying to figure out on the proper way for the additional string validation. I have an SQL query below which is compiled on c#, detected by Checkmarkx application that the Row.Cells[2].Text is not ...
Lia Lucindia's user avatar
-1 votes
1 answer
97 views

Wrong output parameter read from T-SQL stored procedure [duplicate]

I have to read a value from a simple T-SQL stored procedure. When I test the procedure in SQL, it works fine. But when I try to read by a C# SqlCommand, it returns a wrong value that is always 0 (zero)...
Riccardo's user avatar
0 votes
4 answers
103 views

How to remove duplicate rows with the same column in SQL

I have the following table in SQL: I want to remove rows with the same id value. Which query in SQL should I use? The table should be as follows after the delete operation:
user's user avatar
  • 136
0 votes
2 answers
98 views

How can i write raw SQL commands in EntityFramework 6

I'm trying to do a raw SQL statement which resembles this DELETE FROM db.T0590_CODE_STRING WHERE IN (1,1,2,3,5) the values in the IN clause are from rowIds list so therefore I'm trying to use a ...
Bouyalife's user avatar
0 votes
1 answer
38 views

Adding variable in SQL command not working with Select statement

Code: x = int(id_[0]) select_query = "SELECT * FROM files WHERE id = %s" cursor.execute(select_query,x) results = cursor.fetchone() I am using mySQL in Python. This is the error I get: ...
Tamer Vassib's user avatar
0 votes
1 answer
82 views

C# string to number

I want to store to a column a value from string to number I have this part of code in c# //Order string refId = order.id.ToString(); ApplicationLogger.Write("order.date_created : " + order....
ΙΩΑΝΝΗΣ ΡΙΣΒΑΣ's user avatar
0 votes
0 answers
399 views

SQL Server throwing error on valid SQL - incorrect syntax near 'and'

I have a data transformation application where one of the first steps is for the user to paste in a valid SELECT statement. After it is verified, the app will execute it against their database and ...
Skattch's user avatar

15 30 50 per page
1
2 3 4 5
62