Im getting that error (It is strange. I Run my programme step by step
pressing f11. im looping SqlCommand in a while loop. The First step runs but
when a enter 2nd step in my loop it returns error ? )
any idea ?
System.Data.Sql Client.SqlExcep tion: Procedure or function sp_adduser has
too many arguments specified
My Stored Procedure
CREATE PROCEDURE ST_BOTMARKA
@SiteID INT,
@Marka NVARCHAR (255),
@MarkaLink NVARCHAR (500),
@Tarih NVARCHAR (300)
AS
IF Exists( SELECT 1 FROM TBL_BOTMARKALAR Where MarkaAdi=@Marka AND
SiteID=@SiteID)
UPDATE TBL_BOTMARKALAR SET MarkaLink=@Mark aLink,Tarih=@Ta rih
ELSE
INSERT INTO TBL_BOTMARKALAR (SiteID,MarkaAd i,MarkaLink,Tar ih) Values
(@SiteID,@Marka ,@MarkaLink,@Ta rih)
GO
con.ConnectionS tring = "Initial Catalog=saat;Us er
Id=sates52;pass word=abc;Data Source=127.0.0. 1";
Today = ConvertDateFunc tion(System.Dat eTime.Now);
while (true)
{
con.Open ();
cmd.Connection =con;
cmd.CommandType =CommandType.St oredProcedure;
cmd.CommandText ="ST_BOTMARK A";
cmd.Parameters. Add ("@SiteID",SqlD bType.Int).Valu e=1;
cmd.Parameters. Add ("@Marka",SqlDb Type.NVarChar). Value=Marka;
cmd.Parameters. Add ("@MarkaLink",S qlDbType.NVarCh ar).Value=Marka Link;
cmd.Parameters. Add ("@Tarih",SqlDb Type.NVarChar). Value=Today;
try
{
cmd.ExecuteNonQ uery ();
}
catch (Exception e)
{
MessageBox.Show (e.ToString());
}
cmd.Dispose();
con.Close();
} 4 1367
Are you re-using a command without Clear()ing the parameters first?
Alternatively, if performing the same command with different
parameter-values, then add them *once* at the top, and then in the
loop just update the values of each parameter as required.
Marc
Thank you for your reply
I used
cmd.Dispose();
hoping to clear all data which cmd object is keeping.
I used
cmd.Parameters. Clear ();
and it worked.
<in da club>, haber iletisinde şunları
yazdı:Ou******* ******@TK2MSFTN GP05.phx.gbl...
Im getting that error (It is strange. I Run my programme step by step
pressing f11. im looping SqlCommand in a while loop. The First step runs
but when a enter 2nd step in my loop it returns error ? )
any idea ?
System.Data.Sql Client.SqlExcep tion: Procedure or function sp_adduser has
too many arguments specified
My Stored Procedure
CREATE PROCEDURE ST_BOTMARKA
@SiteID INT,
@Marka NVARCHAR (255),
@MarkaLink NVARCHAR (500),
@Tarih NVARCHAR (300)
AS
IF Exists( SELECT 1 FROM TBL_BOTMARKALAR Where MarkaAdi=@Marka AND
SiteID=@SiteID)
UPDATE TBL_BOTMARKALAR SET MarkaLink=@Mark aLink,Tarih=@Ta rih
ELSE
INSERT INTO TBL_BOTMARKALAR (SiteID,MarkaAd i,MarkaLink,Tar ih) Values
(@SiteID,@Marka ,@MarkaLink,@Ta rih)
GO
con.ConnectionS tring = "Initial Catalog=saat;Us er
Id=sates52;pass word=abc;Data Source=127.0.0. 1";
Today = ConvertDateFunc tion(System.Dat eTime.Now);
while (true)
{
con.Open ();
cmd.Connection =con;
cmd.CommandType =CommandType.St oredProcedure;
cmd.CommandText ="ST_BOTMARK A";
cmd.Parameters. Add ("@SiteID",SqlD bType.Int).Valu e=1;
cmd.Parameters. Add ("@Marka",SqlDb Type.NVarChar). Value=Marka;
cmd.Parameters. Add ("@MarkaLink",S qlDbType.NVarCh ar).Value=Marka Link;
cmd.Parameters. Add ("@Tarih",SqlDb Type.NVarChar). Value=Today;
try
{
cmd.ExecuteNonQ uery ();
}
catch (Exception e)
{
MessageBox.Show (e.ToString());
}
cmd.Dispose();
con.Close();
}
>Im getting that error (It is strange. I Run my programme step by step
pressing f11. im looping SqlCommand in a while loop. The First step runs but
when a enter 2nd step in my loop it returns error ? )
any idea ?
System.Data.Sql Client.SqlExcep tion: Procedure or function sp_adduser has
too many arguments specified
My Stored Procedure
CREATE PROCEDURE ST_BOTMARKA
@SiteID INT,
@Marka NVARCHAR (255),
@MarkaLink NVARCHAR (500),
@Tarih NVARCHAR (300)
AS
IF Exists( SELECT 1 FROM TBL_BOTMARKALAR Where MarkaAdi=@Marka AND
SiteID=@SiteID)
UPDATE TBL_BOTMARKALAR SET MarkaLink=@Mark aLink,Tarih=@Ta rih
ELSE
INSERT INTO TBL_BOTMARKALAR (SiteID,MarkaAd i,MarkaLink,Tar ih) Values
(@SiteID,@Marka ,@MarkaLink,@Ta rih)
GO
con.ConnectionS tring = "Initial Catalog=saat;Us er
Id=sates52;pass word=abc;Data Source=127.0.0. 1";
Today = ConvertDateFunc tion(System.Dat eTime.Now);
while (true)
{
con.Open ();
cmd.Connection =con;
cmd.CommandType =CommandType.St oredProcedure;
cmd.CommandText ="ST_BOTMARK A";
cmd.Parameters. Add ("@SiteID",SqlD bType.Int).Valu e=1;
cmd.Parameters. Add ("@Marka",SqlDb Type.NVarChar). Value=Marka;
cmd.Parameters. Add ("@MarkaLink",S qlDbType.NVarCh ar).Value=Marka Link;
cmd.Parameters. Add ("@Tarih",SqlDb Type.NVarChar). Value=Today;
try
{
cmd.ExecuteNonQ uery ();
}
catch (Exception e)
{
MessageBox.Show (e.ToString());
}
cmd.Dispose();
con.Close();
}
You add parameters to the stored procedure in a loop.So u add the parameters while true.You should not add parameters in a loop
___
Newsgroups brought to you courtesy of www.dotnetjohn.com
Encik,
At the first place I do not think you should use while (true). What is the
reason you use while (true) ? It is damn bad practise lah encik.
You memang perlu pakai condition lah
chanmm
"kmitzu" <pr********@yah oo.comwrote in message
news:eb******** ******@TK2MSFTN GP06.phx.gbl...
>
>>Im getting that error (It is strange. I Run my programme step by step
pressing f11. im looping SqlCommand in a while loop. The First step runs
but
when a enter 2nd step in my loop it returns error ? )
any idea ?
System.Data.Sql Client.SqlExcep tion: Procedure or function sp_adduser has
too many arguments specified
My Stored Procedure
CREATE PROCEDURE ST_BOTMARKA
@SiteID INT,
@Marka NVARCHAR (255),
@MarkaLink NVARCHAR (500),
@Tarih NVARCHAR (300)
AS
IF Exists( SELECT 1 FROM TBL_BOTMARKALAR Where MarkaAdi=@Marka AND
SiteID=@SiteID)
UPDATE TBL_BOTMARKALAR SET MarkaLink=@Mark aLink,Tarih=@Ta rih
ELSE
INSERT INTO TBL_BOTMARKALAR (SiteID,MarkaAd i,MarkaLink,Tar ih) Values
(@SiteID,@Marka ,@MarkaLink,@Ta rih)
GO
con.ConnectionS tring = "Initial Catalog=saat;Us er
Id=sates52;pass word=abc;Data Source=127.0.0. 1";
Today = ConvertDateFunc tion(System.Dat eTime.Now);
while (true)
{
con.Open ();
cmd.Connection =con;
cmd.CommandType =CommandType.St oredProcedure;
cmd.CommandText ="ST_BOTMARK A";
cmd.Parameters. Add ("@SiteID",SqlD bType.Int).Valu e=1;
cmd.Parameters. Add ("@Marka",SqlDb Type.NVarChar). Value=Marka;
cmd.Parameters. Add ("@MarkaLink",S qlDbType.NVarCh ar).Value=Marka Link;
cmd.Parameters. Add ("@Tarih",SqlDb Type.NVarChar). Value=Today;
try
{
cmd.ExecuteNonQ uery ();
}
catch (Exception e)
{
MessageBox.Show (e.ToString());
}
cmd.Dispose();
con.Close();
}
You add parameters to the stored procedure in a loop.So u add the
parameters while true.You should not add parameters in a loop
___
Newsgroups brought to you courtesy of www.dotnetjohn.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rob Ristroph |
last post by:
Hi,
It's pretty unhelpful to post "I have a huge piece of code that
crashes in strange places, what's the problem?" but that's basically
my problem and I really am at my wit's end.
The piece of code in question always crashes in an STL operation
such as a vector.push_back, but the location of the crash changes as I
change how various parts are handled in memory, i.e., make some things
dynamically allocated instead of new'd. I know...
|
by: Paul Drummond |
last post by:
Hi all,
I am developing software for Linux Redhat9 and I have noticed some very
strange behaviour when throwing exceptions within a shared library.
All our exceptions are derived from std::exception. We have a base
class which all processes derive from which is always instantiated in
main surrounded by a try/catch(std::exception) which catches all
exceptions that have not be handled at a higher level. The catch block
cleans up and...
|
by: Neil Ginsberg |
last post by:
I have a strange situation with my Access 2000 database. I have code in the
database which has worked fine for years, and now all of a sudden doesn't
work fine on one or two of my client's machines. The code opens MS Word
through Automation and then opens a particular Word doc. It's still working
fine on most machines; but on one or two of them, the user is getting an
Automation Error. The code used is as follows:
Dim objWord As...
|
by: TB |
last post by:
I am seeing a very strange problem as follows...
I have a loop where a fair amount of processing is going on and near
the top of the loop I access a class that has only static helper
functions to perform some calculations. After some number of
iterations, randomly, I'll get an uncaught NullValueException error on
one of these calls, as if the class name is being treated as an object
reference and is null. Here is some psuedo-code to...
|
by: Sam Kong |
last post by:
Hello!
Recently I had a strange problem with Visual C# 2005 beta 1.
When I ran(F5 key) a program, <#if DEBUG> statement was not working.
It ran as RELEASE mode.
So I had to manually define DEBUG to make #if DEBUG work.
When I first started the project, this problem didn't exist.
The problem started to exist in the middle of doing the project.
Today, I decided to figure out what went wrong.
| |
by: Spam Trap |
last post by:
I am getting strange resizing problems when using an inherited form.
Controls are moving themselves seemingly randomly, but reproducibly.
"frmBase" is my base class (a windows form), and contains a few controls
anchored to the sides of the form.
"frmChild" inherits from "frmBase"... and the controls appear on the
inherited form as expected. However things start going wrong when I place
addition controls on the "frmChild" form. When I...
|
by: Martin Joergensen |
last post by:
Hi,
I've encountered a really, *really*, REALLY strange error :-)
I have a for-loop and after 8 runs I get strange results...... I
mean: A really strange result....
I'm calculating temperatures. T = 20 degrees at all
times.... The 2D T-array looks like this:
|
by: StephQ |
last post by:
I have a class Bounds with two constructors:
class Bounds
{
private:
list<SegmentupperLinearSpline; // Upper bound.
list<SegmentlowerLinearSpline; // Lower bound.
....
|
by: Dox33 |
last post by:
I ran into a very strange behaviour of raw_input().
I hope somebody can tell me how to fix this.
(Or is this a problem in the python source?)
I will explain the problem by using 3 examples. (Sorry, long email)
The first two examples are behaving normal, the thirth is
strange.......
I wrote the following flabbergasting code:
#-------------------------------------------------------------
|
by: ioni |
last post by:
Good day, fellows!
I have a strange problem – at my site there is a flash strip, that
loads data dynamically.
It works fine (grabs data from the remote server and presents it),
however in IE7 and its clones I encounter a strange problem where I
can hear clicking sound non-stop (like the page is being reloaded non-
stop), whereas the page is not reloading.
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |