Questions tagged [sqlparameter]

a .NET class for representing SQL parameters in SqlCommands

SqlParameter is a noninheritable .NET class in the System.Data.SqlClient namespace whose instances represent a parameter for a SqlCommand.

319 questions
0
votes
0 answers

ADO.NET SqlParameter Object

I'm working in C#, and trying to work with a Sybase database via ADO.NET. The database is currently being interacted with via NHibernate. I have declared the SqlCommand object "cmd" and am attempting to convert three different types of queries. I…
0
votes
1 answer

Get Params of a QueryString and their datatypes

Let's say you have an delphi interface that has a TEdit where an user types and SQL Query SELECT * FROM X WHERE X.A = :A and X.B = :B and X.C= :C Is there a way to get the types of the :A,:B,:C Params? I managed to get the name of the Params.…
CiucaS
  • 2,010
  • 5
  • 36
  • 63
0
votes
0 answers

No value was supplied, to Output Parameter

I am getting error as "Procedure or function 'Artical_i' expects parameter '@ID', which was not supplied.". But my @ID parameter is Output parameter. -------------------------------c# Code---------------------------------------- int…
AK47
  • 3,707
  • 3
  • 17
  • 36
0
votes
1 answer

Passing a DataValueField of a nested Drop Down List to an Update SQL command

I have a dynamic Drop Down List nested in the Edit mode of a FormView. A user can select a value from the DDL and click the Update button to update a row in a database.
Gloria
  • 1,305
  • 5
  • 22
  • 57
0
votes
1 answer

Must declare the scalar variable "@historyId" exception

I have a working raw Sql command execution using (var cmd = SqlUtils.CreateSqlCommand(cmdText, sqlConn)) { cmd.Parameters.Add(new SqlParameter("historyId", SqlDbType.Int)).Value = AAverage.CashFlowRelevantHistoryId; …
pf1957
  • 997
  • 1
  • 5
  • 20
0
votes
2 answers

SQL Parameters Inside A Loop

i have a list that i am pulling things out of to insert into a database. This is not going to be a web app so i have just been doing as follows: string sqlStorage = (null,"asd"), for (int i = 1; i < listsize; ) { sqlStorage = sqlStorage +…
loveforfire33
  • 1,090
  • 3
  • 25
  • 46
0
votes
2 answers

SQLClient output parameter returns DBNull

Its a ASP.net application in VS2008, connecting to SQL 2005 database. No errors calling the Stored procedure, db update is successful but the OUTPUT param returns DBnull all the time. Below the vb code: Dim ConnectString As String = "", connect As…
user836107
  • 189
  • 1
  • 9
0
votes
1 answer

Using This Week/Last Week for an automatically running report

I have set the dates in the parameter as below, but I'm lost with the next bit... what I want is; If @TodayDayOfWeek < 5 (so it is Monday - Thursday) then run last week's dates (from @Startoflastweek - @endoflastweek) else use this weeks date…
0
votes
1 answer

ASP.NET / VB.NET - Get parameter by name from MySqlParameter list

I'm passing a method a list of MySqlParameters as follows: ByVal Params As List(Of MySqlParameter) If I have multiple parameters in this list and I want to check the value of a particular one, how can I get a reference to that parameter by…
user2233219
0
votes
1 answer

Handle single quote in SqlParameter in EXEC sp_setapprole?

I have a method that executes a SqlCommand and returns the result to a winforms application. My method is this: public bool ApplyRoles(string roleApp, string roleAppPassword) { Command = new SqlCommand("EXEC sp_setapprole @roleApp,…
Phoenix_uy
  • 3,173
  • 9
  • 53
  • 100
0
votes
1 answer

Passing a parameter to a stored procedure

I would like to pass a parameter to this stored procedure: ALTER PROCEDURE [USP_SelectProject] -- Add the parameters for the stored procedure here @ProjectNumber as int AS BEGIN if @ProjectNumber is null begin select * from…
Marcus72
  • 99
  • 3
  • 14
0
votes
2 answers

SQL ExecuteNonQuery throws "Incorrect syntax near '0'."

I have the following code that I am using to insert a number of rows into a database: _conn.Open(); SqlCommand command = new SqlCommand(_insert[0].ToString(), _conn); command.Parameters.AddRange((_insert[1] as…
BrianKE
  • 4,035
  • 13
  • 65
  • 115
0
votes
1 answer

Update statement in exec with parameters - invalid column error

I have a temporary table with 5 columns. I get four columns from existing tables so make use of insert with select statement, which works fine. However the column which is not populated I need it to be a string which is basically a parameter value.…
Abe
  • 1,879
  • 2
  • 24
  • 39
0
votes
1 answer

SQL Parameter in c# not working for some reason

I am using the following code in c# which is trying to filter data by two given parameters. However, it is not working. Would you have any suggestions. Thanks, Vancho Here is the code public void TestQuery() { SqlCommand sqlCommand =…
0
votes
1 answer

adding a table as parameter in a query string in a stored procedure

I have the following query : ALTER procedure [dbo].[jk_insertAllLocation] @locationTbl as locationTable readonly, @TableName varchar(100) as declare @tbl as locationTable,@sql varchar(max) begin set @sql = 'insert into ' +…
User7291
  • 1,095
  • 3
  • 29
  • 71