Link to home
Start Free TrialLog in
Avatar of DCampbell2006
DCampbell2006

asked on

System.NullReferenceException

Hello Community -- I have a .NET 2003 app that I converted to .NET 2005. I'm receiving an error message "System.NullReferenceException" when I complie. Here's the code -- Thank you in advance.

private DataTable GetWeekDays(){
 string query = "SELECT * from dbo.fnGetWeekDay('" + selection.ToShortDateString() + "') order by Seq";

DataSet ds = SqlHelper.ExecuteDataset(Application["DBConn"].ToString(), CommandType.Text, query);
return ds.Tables[0];
            }//GetWeekDays()
SOLUTION
Avatar of gdupadhyay
gdupadhyay
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
For DB connection, why you are not using web.config to store the connection string.
Please read this article for more information about the web.config
http://msdn.microsoft.com/en-us/library/ms178411.aspx
Let me know if you have any question.

Thanks
Ganesh
SOLUTION
Avatar of Joel Coehoorn
Joel Coehoorn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DCampbell2006
DCampbell2006

ASKER

used a copy of Microsoft.ApplicationBlocks.Data.dll from a coworker and app works fine. Thank you all....