Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Ambiguous column detected

Author  Topic 

kdnichols
Posting Yak Master

232 Posts

Posted - 2010-12-13 : 14:53:16
Hello All,

I am using Visual Studio 2008 and I am getting the following error message : Ambiguous column name 'Currency'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Ambiguous column name 'Currency'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


<asp:SqlDataSource ID="Currency" runat="server"
ConnectionString="<%$ ConnectionStrings:FABConnectionString %>"
SelectCommand="SELECT [Currency], [Currency] + ' ' + [Currency_Name] AS Currency FROM [Currency Master]ORDER BY [Currency]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="Exchange" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:FABConnectionString %>"
DeleteCommand="DELETE FROM [Exchange Rate] WHERE [Exchange Group] = @original_Exchange_Group AND [Currency Master.Currency] = @original_Currency AND [RateDate] = @original_RateDate AND [Exchange Rate] = @original_Exchange_Rate"
InsertCommand="INSERT INTO [Exchange Rate] ([Exchange Group], [Currency], [RateDate], [Exchange Rate]) VALUES (@Exchange_Group, @Currency, @RateDate, @Exchange_Rate)"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT * FROM [Exchange Rate] ORDER BY [Currency]"
UpdateCommand="UPDATE [Exchange Rate] SET [RateDate] = @RateDate, [Exchange Rate] = @Exchange_Rate WHERE [Exchange Group] = @original_Exchange_Group AND [Currency] = @original_Currency AND [RateDate] = @original_RateDate AND [Exchange Rate] = @original_Exchange_Rate">
<DeleteParameters>


I have tried using brackets. column and no luck any ideas out there?

X002548
Not Just a Number

15586 Posts

Posted - 2010-12-13 : 14:55:22
why aren't you calling stored procedures?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-12-13 : 15:29:41
It's likely here:

SELECT [Currency], [Currency] + ' ' + [Currency_Name] AS Currency FROM [Currency Master] ORDER BY [Currency]

How about:
SELECT [Currency], [Currency] + ' ' + [Currency_Name] AS Currency2 FROM [Currency Master] ORDER BY [Currency] <--not sure which one you want to order by, I left it as Currency

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-12-13 : 15:56:59
Is Currencey a money datatype?

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
   

- Advertisement -