Click here to Skip to main content
14,429,446 members
Rate this:
Please Sign up or sign in to vote.
Hello,

Im trying to configure a Chart in C# but i keep getting this error Message :
"The variable name <name> as already been declared. Variable names must be unique within a query batch or a storage procedure."

I tried to change the varible name and that message keeps showing.

Thanks.

Heres the code :
declare @var varchar
SET @var = ''


Heres a PrtScreen
http://postimage.org/image/saavng62p/[^]
Posted
Updated 21-May-12 5:41am
v2
Comments
sjelen 21-May-12 10:05am
   
The posted code does not demonstrate the error. Improve question and provide more details.
Member 8956437 21-May-12 10:37am
   
Its just that, i get that error only by writting that code. I will provide a ScreenShot.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

oh you can't do that on queries in a datasource in .net

you can only write queries like "select ...." "delete...." etc.
but you can not declare stuff like that, if you need it, will have to do it using an stored procedure and select the output from the stored proc.
   
Comments
Member 8956437 21-May-12 12:28pm
   
Thanks.
Whats that stored procedure?
[no name] 21-May-12 12:34pm
   
http://msdn.microsoft.com/en-us/library/aa174792(v=sql.80).aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100