15,922,584 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Visual Basic questions
View Javascript questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Dmytro Bogachev (Top 7 by date)
Dmytro Bogachev
29-Nov-13 8:26am
View
You don't have to make any returns; changes in your function GetExcelData:
1. Inside of function, remove all declarations of datasets;
2. Remove return (you have void return type, check in my answer);
Since your parameters are ds1, ds2, ds3, this is new code of your data filling:
command1.Fill(ds1);
command2.Fill(ds2);
command3.Fill(ds3);
3. And since you declared datasets before passing them to this function, they will be filled with data. You don't have to return them. They are reference types, so when calling function, they are passed by reference. Here is link about passing parameters in C#, and you can find there info about passing by value and passing by reference:
http://msdn.microsoft.com/en-us/library/vstudio/0f66670z.aspx
Dmytro Bogachev
29-Nov-13 7:05am
View
There is something we're missing about your question. Control should be initialized already on Page_Load. Maybe you're using Custom Controls and your link button is in custom control, maybe there is some issue about cache, if you use it, but anyways it is not about code you posted here. I suggest you open new question with brief description of your current page structure, which will ask, why lnkUrl is null during Page_Load event.
Dmytro Bogachev
29-Nov-13 6:04am
View
One of possible reasons - this control is not yet initialized. What is the event (Page event), in which you're having code, that throws exception?
Dmytro Bogachev
29-Nov-13 6:00am
View
So your problem is not in above code, it is correct. Show please code, where you're getting lnkUrl. Basically it's about this control.
Dmytro Bogachev
29-Nov-13 5:53am
View
Did you try Debug? What is exact line of your exception? There are 2 possible points of failure in above code, Session["ddlCountry"].ToString() - if ToString() for some reason returns null (and I don't see reason for this behavior) and if lnkUrl.Text is null - this is also weird.
Dmytro Bogachev
29-Nov-13 5:39am
View
Let me disagree with you. My answer is similar in Session part. And null-value Session object might be one of reasons why there is such problem. You CAN compare to null, as in your case, but here is what happens in original code:
string s = null; //Session["whatever"] is null
s.ToString(); // And exception
Dmytro Bogachev
28-Nov-13 7:47am
View
Threading itself and locking in particular indeed affects performance, decreasing it. But threading, from other side, makes your solution scalable and responsive. Sometimes you can rework your solution to work without locks, but sometimes, as in your case, you must lock objects to make solution work correctly (or to make them work at all). While lock is in affect, other threads cannot access locked sections of your code, so they will be blocked. Anyway, threading is topic for some academic book, not for small response)
Show More