sqlcommand Questions

1

Solved

Take the following example... Using cn As New SqlConnection(ConnectionString) Try Dim cmd As SqlCommand = New SqlCommand With cmd .Connection = cn .Connection.Open() .CommandText = "dbo.Get...
Yeomanly asked 19/9, 2012 at 16:4

3

Solved

I'm creating a web application that serves as a front end to do SQL Replication. I have many scripts stored in the properties of the program. Let's use the first one as an example. The first scrip...
Jaunita asked 14/9, 2012 at 20:32

2

Solved

I have the following snippet of code in my WCF web service that builds a set of where conditions according to the formatting of the values of a provided dictionary. public static Dictionary<str...
Hernandez asked 13/8, 2012 at 17:6

2

Solved

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 SqlConnection(connstri...
Millennial asked 28/6, 2012 at 7:7

1

Solved

I'm working with a DAL object that is written in a layout similar to the following code. I simplified a lot of the code code just to show the setup. public class UserDatabase : IDisposable { priv...
Schoonmaker asked 27/6, 2012 at 23:31

3

Solved

I am using Microsoft.SqlServer.Management.Smo. My Code: Server server = new Server(new ServerConnection( new SqlConnection(ConnectionString)); server.ConnectionContext.ExecuteNonQuery(script); ...
Tirza asked 9/5, 2012 at 7:53

2

Solved

I need to programmatically create a SQL Server 2008 table in C# such that the columns of the table should be generated from a list of columns (each column name is the name of a row in the table) M...
Impotence asked 5/4, 2012 at 18:12

2

Solved

I'm fairly new to sql and am having a problem with keywords causing havoc in my sql script. I'm trying to execute a list of premade .sql script files in C#. I'm currently reading the file to a stri...
Chalutz asked 27/3, 2012 at 7:49

2

Solved

I have a web service, so the handler is called multiple times concurrently all the time. Inside I create SqlConnection and SqlCommand. I have to execute about 7 different commands. Different comma...
Peyote asked 21/12, 2011 at 12:52

5

Can anyone tell me the following 2 ways of inserting record creates better performance? Case 1 SqlCommand cmd = new SqlCommand(); for (int i = 0; i < 10000; i++) { cmd = new SqlCommand("inse...
Groomsman asked 21/11, 2011 at 21:36

5

Solved

I have the need to Parse a Command.CommandText. I don't want to run the query. I only want to see if the query will succeed if the command was executed. Say i have; "SELECT * FROM SomeTable WHERE...
Sadie asked 16/9, 2011 at 8:56

2

everyone I am a student and new to .NET and specially MVC3 development but for one of my project I’ve to work over it and so going through the learning phase Issue and confusion I am facing is rega...
Treasurer asked 15/10, 2011 at 12:38

3

Solved

I am currently creating a WCF web service. As part of its job, it will unfortunately need to do some fairly intensive computations, however these computations can fortunately be shared between cal...
Jaimeejaimes asked 6/9, 2011 at 7:23

5

Solved

How do I decide what length of time to use as a timeout when using an SqlCommand object? On parts of the code I'm working on (written by somebody else) I have: cmd.CommandTimeout = 60; Which I ...
Canotas asked 11/8, 2011 at 9:38

2

Solved

Does SqlCommand.Clone() create a deep copy or shallow copy? Also, is it safe to call Clone() from multiple threads concurrently (create one command that multiple threads can copy, set parameter val...
Koller asked 26/7, 2011 at 4:32

3

Solved

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 = s.ExecuteReader(...
Fable asked 5/7, 2011 at 20:13

1

Solved

Problem: I have a form with text values, and a function that must return a string query based on the values of the text values too. Solution: I created a SQLCommand query with parameters, then I p...

3

Solved

Which one would be better in executing an insert statement for ms-sql database: Sql DataAdapter or SQL Command Object? Which of them would be better, while inserting only one row and while in...
Tamp asked 4/7, 2011 at 8:24

3

Solved

Possible Duplicate: Pros and Cons of using SqlCommand Prepare in C#? This is what MSDN says about SqlCommand.Prepare(): Creates a prepared version of the command on an instance of...
Purington asked 28/4, 2011 at 12:32

3

Solved

I have some Transact-SQL that lloks like this, can it be executed through a SqlCommand object, or do I need to start learning Sql Management Objects? BEGIN TRANSACTION BEGIN TRY IF NOT EXISTS (...
Chloromycetin asked 13/4, 2011 at 18:56

5

Solved

string commandGetIslemIdleri = ("EXEC GetIslemIdleri"); cmd = new SqlCommand(commandGetIslemIdleri, sqlConn); cmd.Parameters.Add(new SqlParameter("@CARIID", 110)); using (var reader = cmd.Exe...
Caftan asked 23/3, 2011 at 15:40

1

Solved

I wonder, what is the reason to have this SqlCommand constructor overload: public SqlCommand( string cmdText, SqlConnection connection, SqlTransaction transaction ) ? When I need to create a...
Cho asked 25/10, 2010 at 11:0

2

Solved

There is a related question to this: What's the best method to pass parameters to SQLCommand? But I am wanting to know what the differences are and if there are any problems with the differen...
Integrated asked 7/1, 2011 at 11:2

6

Solved

I seem to be confused on how to perform an In statement with a SqlParameter. So far I have the following code: cmd.CommandText = "Select dscr from system_settings where setting in @settings"...
Dreda asked 21/12, 2010 at 18:50

4

Solved

Folks, Unless I'm mistaken, a parameterized sql query can be generated by specifying SqlDbType for each parameter or not. It seems that I can construct an SqlParameter by providing the parameter n...
Libertine asked 16/12, 2010 at 16:24

© 2022 - 2024 — McMap. All rights reserved.