TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
dc
NA
663
0
C# updating column in sql server database
Feb 12 2013 11:01 PM
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?
Reply
Answers (
1
)
C# connect to database
gridview how to select row cell value ...........