I'm having trouble debugging the following code, in which I'm trying to execute a very simple stored procedure without parameters and return the results in a datagrid.<BR><BR>My connection properties (pulled from the web.config page) are working fine on other pages.<BR><BR>Here's the error:<BR>System.NullReferenceException: Value null was found where an instance of an object was required.<BR><BR>The line that is highlighted is:<BR>masdatagrid.datasource = masdatareader<BR><BR>Here's the code, and thanks for any help!<BR>Deborah<BR> <BR> <script runat="server"><BR> protected sub page_load(sender as object, e as eventargs)<BR> <BR> dim masconnection as sqlconnection<BR> dim mascommand as sqlcommand<BR> dim masdatagrid as datagrid<BR> dim dbconnect as string<BR> dim masdatareader as sqldatareader<BR> <BR> dbconnect=configurationsettings.getconfig("DBsettings")("DBConnect")<BR> <BR> masconnection = new sqlconnection(dbconnect)<BR> <BR> mascommand = new sqlcommand("spTEST", masconnection)<BR> mascommand.commandtype = commandtype.StoredProcedure<BR> <BR> <BR> masconnection.open()<BR> masdatareader = mascommand.executereader()<BR> masdatagrid.datasource = masdatareader<BR> masdatagrid.databind()<BR> masconnection.close()<BR><BR> <BR> <BR> end sub<BR></script><BR><BR><font face="arial" size="+1">Import Invoices</font><BR><p><BR><BR><BR><asp:datagrid runat="server" id="masdatagrid" width="100%" <BR>BorderWidth="0"<BR> CellPadding="2"<BR> Font-Name="Verdana"<BR> Font-Size="Smaller"<BR> <BR> HeaderStyle-HorizontalAlign="Center"<BR> HeaderStyle-Font-Bold="True"<BR> HeaderStyle-BackColor="Navy"<BR> HeaderStyle-ForeColor="White"<BR> <BR> AlternatingItemStyle-BackColor="#dddddd" />My guess would be that the line:<BR><BR>masdatareader = mascommand.executereader() is returning null, which could be because the UserID you used does not have permission to the stored procedure, or the stored procedure has some error, or masconnection never gets properly created.<BR><BR>Try putting a breakpoint at dbconnect=configurationsettings.getconfig("DBsettings")("DBConnect")<BR>and step through it line by line, checking to see which value first returns null.<BR><BR>Hope that helps.Thanks very much for the suggestion!<BR><BR>I think my connection is ok because if I put in the name of a stored procedure that doesn't exist, I get a SQLException "Could not find stored procedure..."<BR><BR>Also, I was unable to test as you suggested because I couldn't figure out how to add a breakpoint. All the documentation I could find referred to visual studio.net, which I don't have.<BR><BR>Thanks!<BR>Deborah