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
1
vote
1 answer

How to use the IN clause while using EntityManager with Hibernate

How do I exactly write the following query using entityManager. Select * from TABLE_NAME where column_name in ('A', 'B'); I tried with the setParametrList() method. However, it says that this method is not available for type Query. Query query =…
Saurabh Tiwari
  • 4,632
  • 9
  • 42
  • 82
1
vote
1 answer

How to pass parameters to dataadapter?

I have code below which i use to select data from sql database table using dataadapter but i throws an error: "Must declare the scalar variable"@UserName" Where is the mistake in code???? I have tried the code below which throws an error "Must…
user8820917
1
vote
2 answers

SqlParameter ParameterDirection

A developer asked me today if there are disadvantages or risks while setting all SqlParameters for a SqlCommand to ParameterDirection.InputOutput. I coudn't think of any expect maybe some performance issues (but not even sure of that)? Someone…
gsharp
  • 27,557
  • 22
  • 88
  • 134
1
vote
2 answers

Is there an overload to add sqlparameters with name, type, value

When adding parameters to a SQLCommand, is there an overload that includes 'parameter name', 'type and 'value' otherwise i end up writing something like: using cmd as new SQLCommand("SELECT x FROM y WHERE z = @z", cn) Dim p0 as SQLParameter =…
RecMenDat
  • 11
  • 1
1
vote
0 answers

Update a record & return ID of the updated record in C# & SQL

I have written a code to insert a row and return inserted row id to the calling point of that function. Now I need to write a code to update a record & need to get the Id of updated record. How to do it in C#? looking for a same way as insertion…
JayNaz
  • 343
  • 1
  • 5
  • 24
1
vote
4 answers

Procedure or function [sproc_name] expects parameter '@materials', which was not supplied

This is driving me nuts ;) I have this stored procedure ... ALTER PROCEDURE [dbo].[sproc_FindFoundries] (@materials varchar(1000), @capabilities varchar(1000)) AS BEGIN /* insert SQL code here */ END The procedure accepts two comma…
Andy Evans
  • 6,997
  • 18
  • 72
  • 118
1
vote
2 answers

How do I use ADO Parameters at run time in Delphi 2006?

I have been banging my head against the desk with this. I have a simple table with 2 columns, like so: CREATE TABLE [dbo].[MiscInitializers]( [PKey] [int] IDENTITY(1,1) NOT NULL, [Value] [text] NULL, CONSTRAINT [PK_MiscInitializers] PRIMARY KEY…
wades
  • 927
  • 9
  • 24
1
vote
1 answer

Unable to initialise SqlParameter

I have the following code: using System.Data.SqlClient; using OPN.SP_Services.Interface; using wwa.EPR.Services; namespace OPN.SP_Services { public class TestService : UnitOfWork, ITestService { public…
Alex
  • 3,730
  • 9
  • 43
  • 94
1
vote
1 answer

NamedParameterJdbcTemplate query method returning wrong integer value

I am running a simple mysql query using NamedParameterJdbcTemplate in java. The problem is that my java query is returning binary values for the count field i.e 1 for all non-zero values and 0 for all zero values. When I run the same query that jdbc…
eytnihca
  • 23
  • 3
1
vote
2 answers

What value is selected into parameter in SQL query without where clause

For example, I have this query SELECT @param = column from table What value is pulled into @param? I tried this and can't figure out the value that is being pulled. It is not the old record or newer one.
Anurag
  • 78
  • 9
1
vote
1 answer

Why am I getting an error with my parameterized ADO query?

Dim txtFName As TextBox = CType(Wizard1.FindControl("txtFName"), TextBox) Dim txtLName As TextBox = CType(Wizard1.FindControl("txtLName"), TextBox) Dim MyDbConnection As New SqlConnection(ConfigurationManager.ConnectionStrings.Item("Journeyeast…
Chad
  • 23,658
  • 51
  • 191
  • 321
1
vote
1 answer

Passing parameter to stored procedure from C#: Which SQLDbType to use for numeric(18, 0)

I have a stored procedure in SQL Server which has an output parameter pf type numeric(18,0). From C# I create a SqlParameter with a SqlDbType.Decimal and I set precision to 18 and scale to 0. Here is my code: queryParameters[2] = new…
Willy
  • 9,848
  • 22
  • 141
  • 284
1
vote
1 answer

Redefining/Re-setting parameters in MySQL query

I have the following code for inserting data into a table using a MySQL query in VB.NET Dim MySqlCmdStr = "INSERT INTO tb_idlink(id1,id2) " & "VALUES (@par1,@par2)" MySqlCmd.CommandText = MySqlCmdStr Dim checkedItem As Object For Each…
robotHamster
  • 609
  • 1
  • 7
  • 24
1
vote
1 answer

How to use WHERE ID in sql Parameters

I have the following: somequery.SQL.Add('UPDATE `someDBname`.`someTABLEname` SET `client`='''+someForm.Edit1.Text+''', `phone`='''+someForm.Edit2.Text+''', `email`='''+someForm.Edit3.Text+''', `details`='''+someForm.Edit4.Text+''',…
t1f
  • 3,021
  • 3
  • 31
  • 61
1
vote
1 answer

How to store a string in image type column in SQL Server Using SqlParameter

I have a SQL Server database, and I want to store in image type column some string. I'm trying to do the following : SqlParameter myparam = new SqlParameter("@myparam", "VeryLongString"); myparam.SqlDbType = SqlDbType.Image; when I add it to the…
OopsUser
  • 4,642
  • 7
  • 46
  • 71