Hello,
I haven't posted here in a long time, but the last time I got excellent
advice. Hope someone can help again because I'm really stumped...
I have been having trouble with the following SQL query in a C# app:
sqlSelectCommand1.CommandText="Select ServerName + '.' + DBName AS
ServerDBName From TestDBList(nolock)Where ServerName
=('oemsitsql01')Order By ServerDBName";
When I run this in SQL Query Analyzer it runs fine:
Select ServerName + '.' + DBName AS ServerDBName From
TestDBList(nolock)Where ServerName =('oemsitsql01')Order By ServerDBName
But when I put it in C# it compiles fine, but on page load I get the
following error:
Server Error in '/WebApplication1' Application.
------------------------------------------------------------------------
--------
Failed to enable constraints. One or more rows contain values violating
non-null, unique, or foreign-key constraints.
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.ConstraintException: Failed to enable
constraints. One or more rows contain values violating non-null, unique,
or foreign-key constraints.
Source Error:
Line 130: //sqlSelectCommand1.CommandText= "Select Into
#TempServerDBList ServerName + '.' + DBName AS ServerDBName From
TestDBList(nolock)Where ServerName In('" +
ServerListBox.SelectedItem.Value + "')Order By ServerDBName Select *
From #TempServerDBList";
Line 131://"Select distinct DBName From TestDBList(nolock)Where
ServerName ='" + ServerListBox.SelectedItem.Value + "'";
Line 132: sqlDataAdapter1.Fill(DBDataSet1);
Line 133: DBListBox.DataBind();
Line 134:
Any assistance much appreciated.
Thanks,
Jeff
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!