Tagged Questions
0
votes
0answers
85 views
SqlCommand with multiple batched select, insert, update statements
I would like to execute multiple select, insert, update statements in one batch, using one SqlCommand, for improved performance.
The CommandText is assembled dynamically from multiple predefined ...
10
votes
2answers
600 views
How To perform a SQL Query to DataTable Operation That Can Be Cancelled
I tried to make the title as specific as possible. Basically what I have running inside a backgroundworker thread now is some code that looks like:
SqlConnection conn = new ...
0
votes
2answers
684 views
Input string was not in a correct format
I am get an awkward error at ExecuteNonQuery in the second last row.
Errormassage:
A .NET Framework error occurred during execution of user-defined routine or aggregate "sp_InsertShuttleCount":
...
2
votes
3answers
1k views
How to Close a DataReader on Exception
I have the following code in some methods of my Data Layer:
StringBuilder sb = new StringBuilder();
SqlCommand s = new SqlCommand(sb.ToString(), conn);
try
{
SqlDataReader dr = ...
0
votes
4answers
260 views
C# sqldatareader close methode
hallo,
which one is better for closing sqlsreader:
SqlDataReader reader = comm.ExecuteReader();
while (reader.Read())
{
}
reader.Close();
reader.Dispose();
...
0
votes
2answers
502 views
Get an error message from TSQL output clause with SqlDataReader
I have the following SQL
INSERT INTO [dbo].[table1] ([val1], [val2])
OUTPUT INSERTED.*
VALUES (@val1, @val2)
I use SqlCommand.ExecuteReader() to get a SqlDataReader that reads the outputed row. ...
6
votes
2answers
601 views
C# SqlDataReader Execution Statistics and Information
I am creating an automated DB Query Execution Queue, which essentially means I am creating a Queue of SQL Queries, that are executed one by one.
Queries are executed using code similar to the ...