Click here to Skip to main content
15,921,941 members
Please Sign up or sign in to vote.
1.00/5 (1 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 :
SQL
declare @var varchar
SET @var = ''


Heres a PrtScreen
http://postimage.org/image/saavng62p/[^]
Posted
Updated 21-May-12 4: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

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.
 
Share this answer
 
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900