Version: 2.5
template: Adapter
I got this error, How could I fix it?
System.Data.SqlClient.SqlException: The multi-part identifier "caromalive2012.dbo.Range.RangeId" could not be bound.
try
Line 1297: {
Line 1298: adapter.FetchEntityCollection(collection, filter, numberOfRecordsToReturn, sorter, prefetch);
Line 1299: return collection;
Line 1300: }
****
[SqlException (0x80131904): The multi-part identifier "caromalive2012.dbo.Range.RangeId" could not be bound.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1950890
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846875
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
System.Data.SqlClient.SqlDataReader.get_MetaData() +83
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) +954
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +130
System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +162
System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +115
....
/// <summary>Inits RangeEntity's mappings</summary>
private void InitRangeEntityMappings()
{
base.AddElementMapping( "RangeEntity", "caromalive2012", @"dbo", "Range", 12 );
base.AddElementFieldMapping( "RangeEntity", "RangeId", "RangeId", false, (int)SqlDbType.Int, 0, 0, 10, true, "SCOPE_IDENTITY()", null, typeof(System.Int32), 0 );
base.AddElementFieldMapping( "RangeEntity", "RangeName", "RangeName", false, (int)SqlDbType.NVarChar, 250, 0, 0, false, "", null, typeof(System.String), 1 );
base.AddElementFieldMapping( "RangeEntity", "RangeDescription", "RangeDescription", true, (int)SqlDbType.NVarChar, 500, 0, 0, false, "", null, typeof(System.String), 2 );
base.AddElementFieldMapping( "RangeEntity", "RangeImageFileName", "RangeImageFileName", true, (int)SqlDbType.NVarChar, 500, 0, 0, false, "", null, typeof(System.String), 3 );
base.AddElementFieldMapping( "RangeEntity", "CategoryIdFk", "Category_IdFK", true, (int)SqlDbType.Int, 0, 0, 10, false, "", null, typeof(System.Int32), 4 );
base.AddElementFieldMapping( "RangeEntity", "MetaKeywords", "MetaKeywords", true, (int)SqlDbType.NVarChar, 1000, 0, 0, false, "", null, typeof(System.String), 5 );
base.AddElementFieldMapping( "RangeEntity", "MetaDescription", "MetaDescription", true, (int)SqlDbType.NVarChar, 1000, 0, 0, false, "", null, typeof(System.String), 6 );
base.AddElementFieldMapping( "RangeEntity", "PageTitle", "PageTitle", true, (int)SqlDbType.NVarChar, 1000, 0, 0, false, "", null, typeof(System.String), 7 );
base.AddElementFieldMapping( "RangeEntity", "PageHeading", "PageHeading", true, (int)SqlDbType.NVarChar, 1000, 0, 0, false, "", null, typeof(System.String), 8 );
base.AddElementFieldMapping( "RangeEntity", "PageDescription", "PageDescription", true, (int)SqlDbType.NVarChar, 1000, 0, 0, false, "", null, typeof(System.String), 9 );
base.AddElementFieldMapping( "RangeEntity", "Sequence", "Sequence", true, (int)SqlDbType.Int, 0, 0, 10, false, "", null, typeof(System.Int32), 10 );
base.AddElementFieldMapping( "RangeEntity", "CustomImage", "customImage", true, (int)SqlDbType.VarChar, 255, 0, 0, false, "", null, typeof(System.String), 11 );
}
The sql is executed bringing data
SELECT DISTINCT [caromalive2012].[dbo].[Range].[RangeId], [caromalive2012].[dbo].[Range].[RangeName], [caromalive2012].[dbo].[Range].[RangeDescription], [caromalive2012].[dbo].[Range].[RangeImageFileName], [caromalive2012].[dbo].[Range].[Category_IdFK] AS [CategoryIdFk], [caromalive2012].[dbo].[Range].[MetaKeywords], [caromalive2012].[dbo].[Range].[MetaDescription], [caromalive2012].[dbo].[Range].[PageTitle], [caromalive2012].[dbo].[Range].[PageHeading], [caromalive2012].[dbo].[Range].[PageDescription], [caromalive2012].[dbo].[Range].[Sequence], [caromalive2012].[dbo].[Range].[customImage] AS [CustomImage] FROM ( [caromalive2012].[dbo].[Range] INNER JOIN [caromalive2012].[dbo].[Product] ON [caromalive2012].[dbo].[Range].[RangeId]=[caromalive2012].[dbo].[Product].[RangeId_FK]) WHERE ( ( [caromalive2012].[dbo].[Product].[CategoryId_FK] = @CategoryIdFk1 AND [caromalive2012].[dbo].[Product].[ProductDewebbed] = @ProductDewebbed2)) ORDER BY [caromalive2012].[dbo].[Range].[Sequence] ASC