Questions tagged [dbcommand]
38 questions
0
votes
2 answers
DbCommand , Must Declare a variable error
This is my code. I have added the db parameter too but it still shows me error (on execution). Must declare a scalar variable
DbCommand command;
StringBuilder query = new StringBuilder(
…

Ali Shahzeb
- 3
- 1
- 5
0
votes
1 answer
The most accurate way to make sure DbCommand.Cancel() method is working well?
As we know, there's no exception occur on this method. So I have a solution to make sure that it's working.
My solution is using SQL Server Profiler tool to catch SP with Events: RPC:Starting, RPC:Completed. When I call Cancel() method and verify on…

Phillip
- 141
- 8
0
votes
1 answer
Could not find type DbCommandDefinition in System.Data.Common and in System.Data.Entity.Core.Common
someone who can help me with this error:
[InvalidOperationException: Could not find type DbCommandDefinition in System.Data.Common and in…

bvbiz
- 41
- 5
0
votes
1 answer
Easier way to send parameterised query to database?
Is there a way to write the following code in less lines? It seems like a lot of code to execute such a simple query. No LINQ as I am using VS2005. Answers in either VB or C# are acceptable.
Using cmd As DbCommand = oDB.CreateCommand()
…

CJ7
- 22,579
- 65
- 193
- 321
0
votes
1 answer
Handle optional parameters when I call a stored procedure
Problem statement.
Basically I get 3 - 50 parameters that come back from a web service as a NVP array I then need to loop over them create the SQL command parameters for each and call the stored procedure. Is there a more efficient way to handle it…

GoBeavs
- 499
- 2
- 10
- 25
0
votes
1 answer
Update/Delete/Insert DataGridView
I've created an DbDataAdapter from a DbConnection, filled a DataTable, and put it into a DataGridView.
When I addapt/insert/delete data in the DataGridView, I want to save it and update the database.
What do I exactly have to do?
(I've created the…

francisMi
- 925
- 3
- 15
- 31
-1
votes
3 answers
Performing multiple inserts at once in oracle with ExecuteNonQuery
I'm trying to execute multiple inserts at once like this
var mydict = new Dictionary { { 1, 2 }, { 3, 4 } };
var query = string.Join("; ", mydict.Select(x => $"insert into myTable (colA, colB) values ({x.Key},{x.Value})"));
using(var…

Doc
- 5,078
- 6
- 52
- 88
-1
votes
1 answer
ExecuteReader: Connection error message
I would like to display data in my text boxes and i have run across an error in my DAL. I have a stored procedure but i cannot get my data to return in the return value. I would like to use my BLL to return a DataTable. Please can you…

PriceCheaperton
- 5,071
- 17
- 52
- 94