update int column

jassie

Well-known member
Joined
Nov 13, 2012
Messages
61
Programming Experience
1-3
In a C# 2008 windows application, I am trying to determine what is causing a differnce when updating an 'int' column in a sql server 2008 r2 database. When I step though the code on my workstation and I am accessing the field on my sql server 2008 r2 database, the column is updated correctly
*Note: I have 'sa' access on my test sql server 2008 r2 database.
Now this code when into production and the column always has the value of zero instead of the correct value. The only way the column can have a zero is if my linq to sql query returns a null. If the result from the linq query is null, then the code will set the value to 0.
Here is a snippet of the code:
 string SubmissionPkgID = 'valid string value'.
 var varGoodTransCount = (from t in rData.Transactions
   join iw in rData.Ibooks on t.ImportID equals iw.ImportID
   join ip in rData.IPackages on iw.PID equals ip.PID
   where (ip.trc_num != null) && ip.trc_num == SubmissionPkgID
   group ip by ip.trc_num into g
   select new { trc_num = g.Key, Frequency = g.Count() }).FirstOrDefault();

if varGoodTransCount == null then the result of the query is set to 0.

The only other possibility of what is causing the error my be permissions somehow?
Thus can you tell me how when I step though the code on my workstation, I get the values I am expecting to see? (I am checking the value of the column while the application runs at different points and on the last statement before the application finishes executing.)
However now that the code is in production the value of the column is zero.
Thus can you tell me how this could be a possibility? If so, would you tell me how to fix this situation?
 
Last edited by a moderator:
Top Bottom