Last post Aug 09, 2011 12:22 AM by danish_tahir87
Aug 05, 2011 01:30 AM|danish_tahir87|LINK
I have a asp.net project setup at my lcoal PC. On one of its page, I am using the datasets to populate the datagrid. I have a dataset setup in my app_code folder. Their are a couple of entities in that dataset, one view and one sp.
The project runs absolutely fine on my local machine but when I deploy at my server, a quite famous excpetion
"Object reference not set to an instance of an object.":
ds.spDataTable Ex = new ds.spDataTable();
Ex = new dsTableAdapters.spTableAdapter().GetData(Convert.ToInt16(a), Convert.ToInt16(b)); //exception occurs at this line
I have the same dataset file ds at the server as of my local. And that dataset is working fine for another of reports which is using the database view placed at this dataset ds
Aug 05, 2011 04:40 AM|Gatsy|LINK
Ex = new dsTableAdapters.spTableAdapter().GetData(Convert.ToInt16(a), Convert.ToInt16(b));
Try to breakpoint at this line and add watch variable a and
b. My guess this has null value.
Aug 05, 2011 04:58 AM|danish_tahir87|LINK
I have tried even with the hard coded valuess....btu that didn't work either!
Aug 08, 2011 09:25 PM|Decker Dong - MSFT|LINK
Do check whether "spTableAdapter()" returns null or not.
Aug 09, 2011 12:22 AM|danish_tahir87|LINK
I have finally found out the solution, actually it was the data set which had the wrong connection string. Thanks for help everyone!