sqlparameter Questions

4

Solved

I am trying to mock database operations. I have problem in mocking SqlParameterCollection. I tried to create virtual method that will return DbParameterCollection but then i am loosing all the func...
Albinus asked 16/6, 2011 at 18:23

3

Solved

How would you specify this: Decimal(18,2) In this: SqlComm.Parameters.Add("@myValue", SqlDbType.Decimal, 0, "myValue"); Currently I have defined precision = 2 from the design side properties...
Wrecker asked 13/7, 2015 at 19:34

5

Solved

I want to pass xml document to sql server stored procedure such as this: CREATE PROCEDURE BookDetails_Insert (@xml xml) I want compare some field data with other table data and if it is matching...
Eskilstuna asked 30/8, 2010 at 11:59

20

Solved

The following code gives an error - "No implicit conversion from DBnull to int." SqlParameter[] parameters = new SqlParameter[1]; SqlParameter planIndexParameter = new SqlParameter("@AgeIndex", S...
Hamadryad asked 29/12, 2010 at 16:42

5

Solved

What I am trying to do is create some arbitrary sql command with parameters, set the values and types of the parameters, and then return the parsed sql command - with parameters included. I will no...
Alveta asked 7/5, 2010 at 14:53

4

Solved

I am working on a social network, one of my procedures returns a VARCHAR output. So this is what I wrote: SqlParameter job1 = cmd2.Parameters.Add("@job", SqlDbType.VarChar); job1.Direction = Param...
Sloan asked 25/12, 2011 at 11:5

2

Solved

I am using the following code: string cmd = "INSERT INTO " + Tables.Lux() + " VALUES(NULL, @Position, @Mode, @Timer)"; try { using (var MyConnection = new MySqlConnection(ConfigurationManager....
Mozellemozes asked 30/6, 2015 at 11:11

2

I want to create SQL variable table in stored procedure which include this; Select a,b,c,d from **@tablename** where a=1 and c=0 How can do this with sp when creating sp?
Cloyd asked 28/7, 2015 at 10:46

2

I am trying to re-write some code to use Dapper so I can easily use parameters. I am trying to execute an UPDATE statement on an Oracle database. A list of IDs to UPDATE is passed in as List<int...
Grice asked 1/2, 2018 at 21:14

7

Solved

I have a number of optional input parameters I am using in a C# class method. Since the optional syntax creates a value of '0' when the parameter is not used, the SQL insert command I call in the m...
Buckle asked 20/12, 2012 at 22:4

9

I have webservice which is passed an array of ints. I'd like to do the select statement as follows but keep getting errors. Do I need to change the array to a string? [WebMethod] public MiniEvent[...
Erbil asked 8/10, 2008 at 10:33

3

Solved

I have the following code. // Get total row count and build Pagination object var countQuery = ArticleServerContext.Database.SqlQuery<int>("GetFullTextSearchCount @SearchTerm", new SqlParam...
Decade asked 19/6, 2016 at 21:27

2

Solved

Before anyone comments that this has been answered before in other question I KNOW that..but in spite of the answers I have reviewed at Assign null to a SqlParameter Sending null parameters to Sq...
Midtown asked 27/5, 2016 at 21:6

1

Solved

From msdn website I get the following: A special data type for specifying structured data contained in table-valued parameters. It seems my code works with it and without it (pushing table to ...
Conglobate asked 6/7, 2015 at 15:58

3

Solved

I got a runtime error saying "Must declare the table variable "@parmTableName". Meaning having table name as sql parameter in the sql-statement is not allowed. Is there a better option or suggesti...
Secern asked 30/7, 2013 at 13:0

1

I am currently learning how to store files without using FILESTREAM attribute on varchar(max) in SQL Server, because I dont need to store very large binary files. Despite that I want to store the b...
Bellwether asked 18/5, 2014 at 13:58

4

Solved

I have a table containing products. I need to make a query finding all the matching results to an user-input value. I am using SqlParameter for the insertion of the inputs. SqlCommand findProcutsB...
Cofield asked 6/9, 2014 at 18:50

4

Solved

I am trying to pass a bit value only if needed (is checked). How do I do this correctly? I am not getting a change in my dataset. SQL Server 2008. if (chkExpired.Checked) CmdGetDetails.Parameter...
Kettledrum asked 2/5, 2014 at 13:14

5

Solved

I have the following query: INSERT INTO CWS_FORWARDING_PROFILE (TNR_COMPANY_PROFILE,BOL_FORWARD_MAIL,BOL_FORWARD_SMS,BOL_FORWARD_MESSAGES ,DT_MO_FROM1,DT_MO_FROM2,DT_MO_FROM3,DT_MO_TO1,DT_MO_TO2...
Rubber asked 21/9, 2011 at 9:48

1

Solved

I've got the following code to pull back a DataTable using a stored procedure and inputting a string parameter @JobNumbers, which is dynamically created string of job numbers (and therefore l...
Splanchnology asked 13/1, 2014 at 9:41

1

Solved

I am attempting to dynamically build a T-SQL statement based on a FieldMapping table and some business rules. Cut the long story short, I have a function that will return the SQL statement as a va...
Cudgel asked 13/11, 2013 at 0:56

4

Solved

I am already pulling the parameters from the stored proc sent in like this: foreach (SqlParameter param in cmd.Parameters) { if ((param.Direction == ParameterDirection.Input) || (param.Directio...
Circumstantiate asked 3/5, 2011 at 18:5

3

Solved

I have stored procedures with same parameters (server name and date). I want to write a stored procedure and Exec them in that SP (called it SP_All). CREATE PROCEDURE [dbo].[SP_All] AS BEGIN exec ...

6

Solved

how to pass sql parameter as null value in to integer data type variable ? StockBO sBO = new StockBO(); sBO.Mode = 2; if (ddcmpanyname.SelectedIndex != 0) { sBO.Client_id = Convert.ToInt16(dd...
Eaglet asked 15/7, 2010 at 5:53

4

Solved

Possible Duplicate: Sanitize table/column name in Dynamic SQL in .NET? (Prevent SQL injection attacks) I have a query like so: "SELECT * FROM MyTable_" + myID + " WHERE variable = @v...
Luci asked 14/12, 2012 at 22:33

© 2022 - 2024 — McMap. All rights reserved.