This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I have a system I inherited that is written in VS 2012 C# using Lightspeed 4.0. There are 3 existing SQL table columns that need to be accessed by the system. The code compiles without issue. When executing the program, I get: (Start Msg) An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll Additional information: Invalid column name 'Field1'. Invalid column name 'Field2'. Invalid column name 'Field3'. (End Msg) This error is generated in the following code:
The " uow.ViewWorkOrders" on the foreach line is highlighted, signifying that is where the error occurred? I was advised to "refresh" the Lightspeed model. How is this done? The references to these columns seem to be in order in the code, but obviously, I'm missing something! Even though the Columns are in the SQL table, it is as if Lightspeed cannot see them. I'm new to using Lightspeed so please forgive and obvious\idiotic errors! Thanks for any help you can give! Boss1b |
|
|
It sounds like there is a difference between your model and database. You can check that your model is in sync with the database through the designer by right clicking and selecting "Update From Source" on the context menu.
|
|
|
Thanks, Jeremy! When I open the WorkOrderModel.lsmodel (or any others) I can right click but have found not context menu or "Update from Source" option. Any ideas what I am doing wrong? |
|
|
Check that you have set a connection string for your model as these options wont appear unless you have this set. You can set this by right clicking and selecting properties on the model and then populating the Connection String option and selecting the Database Provider to match your database configuration. e.g.
|
|
|
Thanks of the help, Jeremy! This db contains two views. Both are identical, save one is for open work orders, the other is for all workorders. During execution, while running App.xaml.cs, processing the view for all workorders, when running the following:
I get the following msg: An unhandled exception of type 'Mindscape.LightSpeed.LightSpeedException' occurred in Mindscape.LightSpeed.dll Additional information: Unable to materialize field [Id] on type [WorkOrderSystem.ViewWorkOrder]. Check your table has an Id column and that your mappings are correct. See inner exception for details. I put the problem area in a try/catch. The next portion of code processes the view for the open records.
It runs correctly. As the views are identical ( I have rebuilt the ViewWorkOrder to be sure), I feel it's something in my code. Any ideas? Thanks again! |
|
|
The properties for the model can be accessed by right clicking on the diagram surface and selecting Properties. Let us know once you have re-synced your model if you are continuing to see issues as these errors typically occur when the model does not match the database schema.
|
|
|
Jeremy, Thank you. That helped! It seems that part of the issue is I was using it with Visual Studio 2012 express. When I switched the application into VS 2012 Pro, I get the proper screens. I still haven't been able to get the database to sync up. Cannot connect to server. I have checked the connection string multiple times, seems to be correct. I have tried it using both windows authentication and SQL Server Authentication. Neither connects. I'm wondering if I need to open a different port on the server. Do you know what port Lightspeed is trying to use? Grasping at straws here.... Thanks, Earl |
|
|
Jeremy, Thank you for you help! Got if figured out finally! Neat product but going to take a bit to understand it all! Anyway, thanks again!> Earl |
|