473,654 Members | 3,184 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Very strange error

I have this store procedure to insert orders in the 'Orders' table of
NorthWind (SQL Server 2000):

CREATE PROCEDURE NuevoPedido
(
@CustomerID nchar(5),
@EmployeeID int,
@OrderDate DateTime,
@RequiredDate DateTime,
@ShipVia int,
@Freight money,
@ShipName nvarchar(40),
@ShipAddress nvarchar(60),
@ShipCity nvarchar(15),
@ShipRegion nvarchar(15),
@ShipPostalCode nvarchar(10),
@ShipCountry nvarchar(15),
@OrderID int OUTPUT
)
as
INSERT INTO Orders
(CustomerID, EmployeeID, OrderDate, RequiredDate, ShipVia, Freight,
ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry)
VALUES
(@CustomerID, @EmployeeID, @OrderDate, @RequiredDate, @ShipVia, @Freight,
@ShipName, @ShipAddress, @ShipCity, @ShipRegion, @ShipPostalCode ,
@ShipCountry)

SELECT @OrderID = @@Identity

When I call it from C# I see an error who says 'Sintax error near
NuevoPedido'.

I can't find the error. Could you help me? Thank you.

Nov 16 '05 #1
7 1155
My SQL Server knowledge is very limited but I think syntax for the procedure
is without parenthesses '( )'
"Alberto" <al*****@nospam .com> wrote in message
news:%2******** *********@TK2MS FTNGP10.phx.gbl ...
I have this store procedure to insert orders in the 'Orders' table of
NorthWind (SQL Server 2000):

CREATE PROCEDURE NuevoPedido
(
@CustomerID nchar(5),
@EmployeeID int,
@OrderDate DateTime,
@RequiredDate DateTime,
@ShipVia int,
@Freight money,
@ShipName nvarchar(40),
@ShipAddress nvarchar(60),
@ShipCity nvarchar(15),
@ShipRegion nvarchar(15),
@ShipPostalCode nvarchar(10),
@ShipCountry nvarchar(15),
@OrderID int OUTPUT
)
as
INSERT INTO Orders
(CustomerID, EmployeeID, OrderDate, RequiredDate, ShipVia, Freight,
ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry) VALUES
(@CustomerID, @EmployeeID, @OrderDate, @RequiredDate, @ShipVia, @Freight,
@ShipName, @ShipAddress, @ShipCity, @ShipRegion, @ShipPostalCode ,
@ShipCountry)

SELECT @OrderID = @@Identity

When I call it from C# I see an error who says 'Sintax error near
NuevoPedido'.

I can't find the error. Could you help me? Thank you.

Nov 16 '05 #2
I try it without the parenthesses and the error it's the same.
Thank you.

"Bastian" <ra****@quickne t.nl> escribió en el mensaje
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
My SQL Server knowledge is very limited but I think syntax for the procedure is without parenthesses '( )'
"Alberto" <al*****@nospam .com> wrote in message
news:%2******** *********@TK2MS FTNGP10.phx.gbl ...
I have this store procedure to insert orders in the 'Orders' table of
NorthWind (SQL Server 2000):

CREATE PROCEDURE NuevoPedido
(
@CustomerID nchar(5),
@EmployeeID int,
@OrderDate DateTime,
@RequiredDate DateTime,
@ShipVia int,
@Freight money,
@ShipName nvarchar(40),
@ShipAddress nvarchar(60),
@ShipCity nvarchar(15),
@ShipRegion nvarchar(15),
@ShipPostalCode nvarchar(10),
@ShipCountry nvarchar(15),
@OrderID int OUTPUT
)
as
INSERT INTO Orders
(CustomerID, EmployeeID, OrderDate, RequiredDate, ShipVia, Freight,
ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode,

ShipCountry)
VALUES
(@CustomerID, @EmployeeID, @OrderDate, @RequiredDate, @ShipVia, @Freight, @ShipName, @ShipAddress, @ShipCity, @ShipRegion, @ShipPostalCode ,
@ShipCountry)

SELECT @OrderID = @@Identity

When I call it from C# I see an error who says 'Sintax error near
NuevoPedido'.

I can't find the error. Could you help me? Thank you.


Nov 16 '05 #3
If you are using an SqlCommand object, make sure that you have the line:

command.Command Type = CommandType.Sto redProcedure;

Otherwise, it's going to try to execute it as text.

Alberto wrote:
I have this store procedure to insert orders in the 'Orders' table of
NorthWind (SQL Server 2000):

CREATE PROCEDURE NuevoPedido
(
@CustomerID nchar(5),
@EmployeeID int,
@OrderDate DateTime,
@RequiredDate DateTime,
@ShipVia int,
@Freight money,
@ShipName nvarchar(40),
@ShipAddress nvarchar(60),
@ShipCity nvarchar(15),
@ShipRegion nvarchar(15),
@ShipPostalCode nvarchar(10),
@ShipCountry nvarchar(15),
@OrderID int OUTPUT
)
as
INSERT INTO Orders
(CustomerID, EmployeeID, OrderDate, RequiredDate, ShipVia, Freight,
ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry)
VALUES
(@CustomerID, @EmployeeID, @OrderDate, @RequiredDate, @ShipVia, @Freight,
@ShipName, @ShipAddress, @ShipCity, @ShipRegion, @ShipPostalCode ,
@ShipCountry)

SELECT @OrderID = @@Identity

When I call it from C# I see an error who says 'Sintax error near
NuevoPedido'.

I can't find the error. Could you help me? Thank you.

Nov 16 '05 #4
"Alberto" <al*****@nospam .com> wrote:
CREATE PROCEDURE NuevoPedido
(
@CustomerID nchar(5),
@EmployeeID int,
[...]
When I call it from C# I see an error who says 'Sintax
error near NuevoPedido'.
I can't find the error. Could you help me? Thank you.


Do you need the AS keyword?

CREATE PROCEDURE NuevoPedido AS
(
....

P.
Nov 16 '05 #5
He has the "AS" in the proper spot, which is after the parameters.
"Alberto" <al*****@nospam .com> wrote:

CREATE PROCEDURE NuevoPedido
(
@CustomerID nchar(5),
@EmployeeID int,
[...]
When I call it from C# I see an error who says 'Sintax
error near NuevoPedido'.
I can't find the error. Could you help me? Thank you.

Do you need the AS keyword?

CREATE PROCEDURE NuevoPedido AS
(
...

P.

Nov 16 '05 #6
The CommandType it's set to StoredProcedure .
Thank you.

"Mike Newton" <MN*****@Addus. com> escribió en el mensaje
news:eJ******** **********@TK2M SFTNGP09.phx.gb l...
If you are using an SqlCommand object, make sure that you have the line:

command.Command Type = CommandType.Sto redProcedure;

Otherwise, it's going to try to execute it as text.

Alberto wrote:
I have this store procedure to insert orders in the 'Orders' table of
NorthWind (SQL Server 2000):

CREATE PROCEDURE NuevoPedido
(
@CustomerID nchar(5),
@EmployeeID int,
@OrderDate DateTime,
@RequiredDate DateTime,
@ShipVia int,
@Freight money,
@ShipName nvarchar(40),
@ShipAddress nvarchar(60),
@ShipCity nvarchar(15),
@ShipRegion nvarchar(15),
@ShipPostalCode nvarchar(10),
@ShipCountry nvarchar(15),
@OrderID int OUTPUT
)
as
INSERT INTO Orders
(CustomerID, EmployeeID, OrderDate, RequiredDate, ShipVia, Freight,
ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry) VALUES
(@CustomerID, @EmployeeID, @OrderDate, @RequiredDate, @ShipVia, @Freight, @ShipName, @ShipAddress, @ShipCity, @ShipRegion, @ShipPostalCode ,
@ShipCountry)

SELECT @OrderID = @@Identity

When I call it from C# I see an error who says 'Sintax error near
NuevoPedido'.

I can't find the error. Could you help me? Thank you.

Nov 16 '05 #7

"Alberto" <al*****@nospam .com> wrote in message news:%2******** *********@TK2MS FTNGP10.phx.gbl ...
I have this store procedure to insert orders in the 'Orders' table of
NorthWind (SQL Server 2000):

CREATE PROCEDURE NuevoPedido
(
@CustomerID nchar(5),
@EmployeeID int,
@OrderDate DateTime,
@RequiredDate DateTime,
@ShipVia int,
@Freight money,
@ShipName nvarchar(40),
@ShipAddress nvarchar(60),
@ShipCity nvarchar(15),
@ShipRegion nvarchar(15),
@ShipPostalCode nvarchar(10),
@ShipCountry nvarchar(15),
@OrderID int OUTPUT
)
as
INSERT INTO Orders
(CustomerID, EmployeeID, OrderDate, RequiredDate, ShipVia, Freight,
ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry)
VALUES
(@CustomerID, @EmployeeID, @OrderDate, @RequiredDate, @ShipVia, @Freight,
@ShipName, @ShipAddress, @ShipCity, @ShipRegion, @ShipPostalCode ,
@ShipCountry)

SELECT @OrderID = @@Identity

When I call it from C# I see an error who says 'Sintax error near
NuevoPedido'.

I can't find the error. Could you help me? Thank you.


A few questions:
- is this procedure already defined in sqlserver or is it part of the query
you want to execute from C#?
- if already in sqlserver (as it should be), can you execute it there?
- what C# code do you use to execute it?

Hans Kesting
Nov 16 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1469
by: Shelly | last post by:
I have come across a strange problem. I am setting up a registration screen with username, password, confirm password, and a couple of other things. The submit button is named "Submit". The others are named "username", "password", and "passwordConfirm". The problem is that when I enter a username and a password of 5 characters with nothing in the passwordConfirm field, I do not get the diagnostic echo messages that I have inserted. ...
14
6334
by: Allcomp | last post by:
Hello, I have seen something really strange in VB6 If I do a Int ( (5 * 1.2)) , I receive the value 5, but I should receive 6? Is this a bug or something really "normal". I can see that if I do ? int ((5 * 1.2 + 0.0000000000000003)) I receive 6. If I add something smaller, I have 5 as a result What is strange is that If I do a ? 5*1.2, I receive 6 so (5 * 1.2)
6
8521
by: leonecla | last post by:
Hi everybody, I'm facing a very very strange problem with a very very simple C program... My goal should be to write to a binary file some numbers (integers), each one represented as a sequence of 32 bit. I made this stupid trial code: --------------------------------------------- FILE *fout;
2
1780
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...
5
1682
by: cody | last post by:
I have a very funny/strange effect here. if I let the delegate do "return prop.GetGetMethod().Invoke(info.AudioHeader, null);" then I get wrong results, that is, a wrong method is called and I have no clue why. But if I store the MethodInfo in a local variable I works as expected. I do not understand why this is so, shouldn't both ways be semantically equal?
2
1494
by: Shapper | last post by:
Hello, I have this code: Dim cultureList(,) As String = {{"E", "en-GB"}, {"P", "pt-PT"}} Select Case Session("culture") Case "pt-PT" ... Dim cultureList(,) As String = {{"E", "en-GB"}, {"P", "pt-PT"}} Response.Write("1")
2
1413
by: Buddy Ackerman | last post by:
I have a web app that I have setup on numerous web servers. I've set one up for a new client at their hosting facility and cannot get it to connect to their database. I get a "SQL Server does not exist or access denied." error. Well, the strangeness is that I have a SQL Query tool installed on this server and can connect to the database fine using the exact same connection parameters that I have specified in my web app. Even more strange...
1
8179
by: Don Rixtown | last post by:
I ran into a very strange error tonight. I was working with web services and typed datasets. The web server I was using happens to be on the other end of a virtual network (Hamachi). Everything was working fine. I added one more row of data to the table and all of a sudden one web method started failing. I initially thought the web service was timing out but after a while the following exception was thrown: The CLR has been unable to...
4
1134
by: Efy | last post by:
Hi, I was debugging my JavaScript in VS2005, the script probably had an error some ware (Line 25), after I fixed the error, I am trying to run the page again I am getting the same error "Illegal argument" at that same line 25. What ever I did does not help, I have closed the program, I restarted my computer, I changed the page to contain very simple html script with no js the error is still there on line 25. I deleted all lines living...
11
1845
by: VijaKhara | last post by:
Hi all, I just write a very simple codes in C and vthere is a very strange bug which I cannot figure out why. The first loop is for v, and the second for k. There is no relationship between v and k but if I debug and watch the change of the variable after each command. When the sencond loop happends for k, the values of vs change and are set to be equal some values of k. Specifically, v is
0
8290
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,...
0
8815
Oralloy
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...
0
8708
jinu1996
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...
1
8489
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,...
1
6161
isladogs
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...
0
5622
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();...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2716
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
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.