You aren't explicitly converting the return value from dc. ExecuteQuery(sql) to the TableData type that you've defined. I expect that the ExecuteQuery is complaining because it doesn't know what the TableData type is The ExecuteQuery helper needs to return a DBML (LINQ-to-SQL generated) type as defined in your database But I would suggest that you don't go down this route.
If you want to get records from a table, say Customers, just use content. Customers the point of LINQ-to-SQL is that it already contains all these accessors to save you time.
You aren't explicitly converting the return value from dc. ExecuteQuery(sql) to the TableData type that you've defined. I expect that the ExecuteQuery is complaining because it doesn't know what the TableData type is.
The ExecuteQuery helper needs to return a DBML (LINQ-to-SQL generated) type as defined in your database. But I would suggest that you don't go down this route. If you want to get records from a table, say Customers, just use content.
Customers - the point of LINQ-to-SQL is that it already contains all these accessors to save you time.
You might try decorating your class properties with ColumnAttributes, specifying the column name and type so that LINQ to SQL knows how to do the version of the column data to the properties. You may also need to set other attribute properties to make it work correctly. I would also specify the column names in the SQL instead of using *.
Put the column names in the same order as your properties appear in the class as I believe that it processes the result values in the same order as the properties are defined. Not sure it this will work or not, but essentially you're recreating what the designer would do for you. Public List tableBrowse(string tablename) { string sql = "Select time, value from " + tablename; var results = dc.
ExecuteQuery(sql); return results.ToList(); } public class TableData { Column( Name="Time", DbType="DateTime NOT NULL", ... ) public int Time { get; set; } Column( Name="Value", DbType="VARCHAR(255) NOT NULL", ... ) public string Value { get; set; } }.
Unfortunately, I tried what you said and it does not help with the cast exception. – mcauthorn Aug 31 '09 at 13:52.
Actually I found out what the problem was, I was missing a table definition. There was a third data type in one of the tables. Once I defined that table class and checked for the data type it worked fine.
Sadly the compiler just didn't give that much information on just what was wrong.
ExecuteQuery(sql) to the TableData type that you've defined. I expect that the ExecuteQuery is complaining because it doesn't know what the TableData type is. The ExecuteQuery helper needs to return a DBML (LINQ-to-SQL generated) type as defined in your database.
But I would suggest that you don't go down this route. If you want to get records from a table, say Customers, just use content. Customers - the point of LINQ-to-SQL is that it already contains all these accessors to save you time.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.