Hi there,
Update:
I think my problem has to do with a database table that I have which has composite keys.
I just tried using the scaffold control in 2.1 latest svn, I found that for many tables in my database this works fine, but for one particular table I have a GUID as foreign key and I noticed that it causes problems:
Operand type clash: uniqueidentifier is incompatible with int
The problem I think lies with how I defined my table
I have 2 tables:
Table1: UserCompetitoin
composite key: UserID PK, CompID PK
Table2: Portfolio
ID PK
UserID FK
CompID FK
What is happening is that the sql being provided by the scaffold control joins on the right columns but only matches the first column as follows:
Query.cs line: 1731
ExecuteJoinedDataSet
strJoin = { INNER JOIN [dbo].[UserCompetition] J1 ON [dbo].[Portfolio].[UserId] = [J1].[UserId] INNER JOIN [dbo].[UserCompetition] J2 ON [dbo].[Portfolio].[CompetitionID] = [J2].[UserId]} <---- should be competitionID
I'm not sure if this is possible?
Here is the error that I receive:
SqlException (0x80131904): Operand type clash: uniqueidentifier is incompatible with int]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +925466
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800118
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1932
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31
System.Data.SqlClient.SqlDataReader.get_MetaData() +62
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1005
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +122
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +7
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[ datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +141
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +86
SubSonic.SqlDataProvider.GetDataSet(QueryCommand qry) in D:\Programming\Projects\SubsonicTest\SubSonic\DataProviders\SqlDataProvider.cs:417
SubSonic.DataService.GetDataSet(QueryCommand cmd) in D:\Programming\Projects\SubsonicTest\SubSonic\DataProviders\DataService.cs:521
SubSonic.Query.ExecuteJoinedDataSet() in D:\Programming\Projects\SubsonicTest\SubSonic\Sql Tools\Query.cs:1801
SubSonic.Scaffold.BindGrid(String orderBy) in D:\Programming\Projects\SubsonicTest\SubSonic\Controls\Scaffold.cs:1287
SubSonic.Scaffold.CreateChildControls() in D:\Programming\Projects\SubsonicTest\SubSonic\Controls\Scaffold.cs:699
SubSonic.Scaffold.ddlTables_SelectedIndexChanged(Object sender, EventArgs e) in D:\Programming\Projects\SubsonicTest\SubSonic\Controls\Scaffold.cs:743
Regards DotnetShadow