New Posts New Posts RSS Feed: Linq statment can run from visual studio but not after installation
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Linq statment can run from visual studio but not after installation

 Post Reply Post Reply
Author
Suah View Drop Down
Newbie
Newbie
Avatar

Joined: 06-Jul-2009
Posts: 16
Post Options Post Options   Quote Suah Quote  Post ReplyReply Direct Link To This Post Topic: Linq statment can run from visual studio but not after installation
    Posted: 12-Jan-2010 at 11:23pm
Hi,

I have these code executed in the constructor/Load event handler:

List<StockStruct> _listSS = new List<StockStruct>();
            var query = _mgr.Stocks
                .Where(s => !s.Inactive)
                .Select(s => new StockStruct
                {
                    StockCode = s.STOCK_CODE,
                    StockDesc = s.STOCK_DESC,
                    GroupCode = s.StockGroup.CODE,
                    SupplCode = "",
                    Location = s.LOCATION
                }).ToList<StockStruct>();
            _listSS.Clear();
            _listSS.AddRange(query);

_listSS is a List<StockStruct>, StockStruct is a class store these information.

This can run fine within Visual Studio, but if the application is installed and distributed and run without visual studio, this statement fails and the constructor failed.

What kind of problems does this code have?


Edited by Suah - 12-Jan-2010 at 11:44pm
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 13-Jan-2010 at 10:24am
It is not unusual to find that code that runs fine in a development environment (with or without Visual Studio) does not execute properly after the application has been deployed.  The most common reason for this is that some library or other piece of code that is present in the development environment is not present in the deployment environment.  Another possibility is that some license key is required, and the license key is present in the development environment and absent in the deployment environment.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down