I get the error 'Procedure 'spBO_HeadlineC reate' expects parameter
'@imageid', which was not supplied' when i call the procedure with the
@imageid=null, but id the @imageid as a diff. value no error occurs.
Here's the code and the storedproc...
-- code
SqlConnection sqlConnection = new System.Data.Sql Client.SqlConne ction
ConfigurationSe ttings.AppSetti ngs["cnStrDBAdm in"]); // Create connection.
SqlCommand sqlUpdProg=new SqlCommand ();
sqlUpdProg.Comm andType=Command Type.StoredProc edure;
sqlUpdProg.Comm andText="spBO_P rogramSave";
sqlUpdProg.Conn ection=sqlConne ction ;
//Handle the parameters
sqlUpdProg.Para meters.Add("@ti tle", SqlDbType.NVarC har);
sqlUpdProg.Para meters.Add("@im ageid", SqlDbType.BigIn t);
sqlUpdProg.Para meters.Add("@da te", SqlDbType.DateT ime);
sqlUpdProg.Para meters.Add("@te xt", SqlDbType.NText );
sqlUpdProg.Para meters["@title"].Value = _title;
sqlUpdProg.Para meters["@date"].Value = _date;
sqlUpdProg.Para meters["@text"].Value = _body;
if (_imageid!=-1)
sqlUpdProg.Para meters["@imageid"].Value = _imageid;
else
sqlUpdProg.Para meters["@imageid"].Value =null; //error occur
try
{
sqlConnection.O pen();
int statusNews = sqlUpdProg.Exec uteNonQuery();
}
catch (Exception ex)
{
System.Diagnost ics.Debug.Write Line("ERROR: " + ex.ToString());
throw(ex);
}
finally
{
sqlConnection.C lose(); //Close the Connection.
}
--code
--storedproc
CREATE PROCEDURE dbo.spBO_Progra mSave
@date smalldatetime,
@title nvarchar(100),
@imageid bigint,
@text ntext
AS
SET NOCOUNT ON
UPDATE dbo.t_programs SET
[date] = @date,
title = @title,
imageid = @imageid,
[text] = @text
GO
--storedproc
i would appreciate any help, thanks a lot
--
Renato /*Portugal*/ Vieira 3 1358
On Thu, 27 Jan 2005 07:41:05 -0800, Renato Vieira wrote: I get the error 'Procedure 'spBO_HeadlineC reate' expects parameter '@imageid', which was not supplied' when i call the procedure with the @imageid=null, but id the @imageid as a diff. value no error occurs.
If you need to indicate null, try passing DBNull.Value instead of null.
--
Tom Porterfield
Hi Renato,
Try setting the imageID parameter value to System.DBNull.V alue. This class
differentiates between a null object and an unitialized value (NULL in the
db).
Please reply to this post if this does not work and I will relook at the
problem.
I hope this helps.
-----------------------------
Thank's a lot Brian and Tom, that solution worked.
Be good... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Paul |
last post by:
Hi,
In SQL Books Online in the section on @@Error it gives the following
example:
-- Execute the INSERT statement.
INSERT INTO authors
(au_id, au_lname, au_fname, phone, address,
city, state, zip, contract) values
(@au_id,@au_lname,@au_fname,@phone,@address,
|
by: Error while executing SP |
last post by:
Hi,
I am getting an error while executing a sp from Oracle database. Can you let me know what could be the problem?
here is the code
using(System.Data.OleDb.OleDbConnection cn = new System.Data.OleDb.OleDbConnection())
{
cn.ConnectionString="Provider=OraOLEDB.Oracle;Password=STORED_OBJ;User ID=STORED_OBJ;Data Source=PDCDGL1.NA.HPFS.COM;Extended Properties=;Persist Security Info=False;PLSQLRSet=1;";
cn.Open();
//String strProcName =...
|
by: randy.p.ho |
last post by:
Using JDBC, is there a way to call a stored procedure with multiple
return values? Thanks.
|
by: Joakim Hove |
last post by:
Hello,
I have implemented a small library with a function a datatype to
manage temporary storage, and handle out correctly casted storage. The
function to get a double pointer is for instance:
double * work_get_double(work_type *work, size_t size) {}
Now, if the work area is not sufficiently large, the function fails,
|
by: Phil Mc |
last post by:
Trying to call a stored proc but some times don't want to have values
inserted in some fields.
Hi
I am rewriting a VBS script which called a stored proc in a SQL server
db. The proc takes a number of values both char and floats.
Sometime it is a requirement that the stored proc will not be given a
values for some of the floats.
| |
by: Henning M |
last post by:
Hej All
Im relativ new to VB.net and im trying to collect som device information
using cfgmgr32.dll
I use - Declare Function GetListLength Lib "cfgmgr32.dll" Alias
"CM_Get_Device_ID_List_SizeA" (ByRef pulLen As Integer, ByVal pszFilter As
Integer, ByVal UlFlags As Integer) As Integer -
To get the length of the device list. This seems to work as I get a
CR_SUCCESS (I get a number around 8500. But as I'm not sure what is in the
|
by: C#_Beginner |
last post by:
I was wondering if someone can help me out. I'm getting the following
error:
Message: ORA-06550: line 1, column 7: PLS-00306: wrong number or types
of arguments in call to 'GET_RIGHTS2' ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'GET_RIGHTS2'
ORA-06550: line 1, column 7: PLS-00306: wrong number or types of
arguments in call to 'GET_RIGHTS2' ORA-06550: line 1, column 7:
PLS-00306: wrong number...
|
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= |
last post by:
I have a C# logging assembly with a static constructor and methods that is
called from another C# Assembly that is used as a COM interface for a VB6
Application. Ideally I need to build a file name based on the name of the
VB6 application. A second choice would be a file name based on the # COM
interface assembly. I have tried calling Assembly.GetCallingAssembly() but
this fails when I use the VB6 client. Is there a way to get this...
|
by: premprakashbhati |
last post by:
hello sir,
goodevening....
iam working on vb6.0 and sql2005.
"select max(centreid) from regionmaster where centreid like '" & intBranchPrefix & "%'", DBConnection, adOpenKeyset, adLockOptimistic
If rsMain.RecordCount > 0 Then
intID = Mid(rsMain(0), 3, 13)
End If
intCentreID = intBranchPrefix & (intID + 1)
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| | |