object reference not set to an instance of an object

5 replies. Last post: January 22, 2010 2:07 AM by Andi Santoso
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback

I have a webgrid bound to a sqldatasource.  The sqldatasource has SelectCommand, InsertCommand, DeleteCommand and UpdateCommand defined.  Whenever I update a row, I get the object reference error.  Select, Insert and Delete all work fine.  My code is listed below:

<ISWebGrid:WebGrid ID="WebGrid1" runat="server" UseDefaultStyle="True" Width="100%" Height="250px" DataSourceID="SqlDataSource1" OnInitializeRow="WebGrid1_InitializeRow" OnDeleteRow="WebGrid1_DeleteRow" > <LayoutSettings AllowAddNew="Yes" AllowEdit="Yes" NewRowLostFocusAction="AlwaysUpdate" FilterBarVisible="False" allowdelete="Yes" > </LayoutSettings> <RootTable ColumnHeaders="Yes" AllowEdit="Yes" AllowDelete="Yes"> <Columns> <ISWebGrid:WebGridColumn Bound="true" DataMember="HARDWARE_SCHED_CODE" Caption="Hardware Schedule Code" Width="10%" Name="hardware_sched_code" DataType="System.Int32" EditType="NoEdit" /> <ISWebGrid:WebGridColumn Bound="true" DataMember="HARDWARE_SCHED_DESCR" Caption="Description" Width="90%" Name="hardware_sched_descr" DataType="System.String" /> </Columns> </RootTable> </ISWebGrid:WebGrid> <asp:Label runat="server" ID="mess" /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DHOUSE %>" ProviderName="Oracle.DataAccess.Client" SelectCommand="SELECT HARDWARE_SCHED_CODE, HARDWARE_SCHED_DESCR FROM HARDWARE_SCHEDULE WHERE (M2O_ID = :M2O_ID)" InsertCommand="INSERT INTO HARDWARE_SCHEDULE(HARDWARE_SCHED_CODE, HARDWARE_SCHED_DESCR,M2O_ID) VALUES (:hardware_sched_code,:hardware_sched_descr,:M2O_ID)" UpdateCommand="update hardware_schedule set hardware_sched_descr=:hardware_sched_descr WHERE M2O_ID = :M2O_ID and HARDWARE_SCHED_CODE=:hardware_sched_code" DeleteCommand="delete_hardware_schedule" DeleteCommandType="StoredProcedure" > <SelectParameters> <asp:SessionParameter Name="M2O_ID" SessionField="m2o_Id" DbType="Int32" /> </SelectParameters> <InsertParameters> <asp:Parameter Name="hardware_sched_code" DbType="Int32" /> <asp:Parameter Name="hardware_sched_descr" DbType="String" /> <asp:SessionParameter Name="M2O_ID" SessionField="m2o_Id" DbType="Int32" /> </InsertParameters> <UpdateParameters> <asp:querystringParameter Name="hardware_sched_code" DbType="Int32" /> <asp:querystringParameter Name="hardware_sched_descr" DbType="String" /> <asp:SessionParameter Name="M2O_ID" SessionField="m2o_Id" DbType="Int32" /> </UpdateParameters> <DeleteParameters> <asp:Parameter Name="hardware_sched_code" DbType="Int32" /> <asp:SessionParameter Name="M2O_ID" SessionField="m2o_Id" DbType="Int32" /> </DeleteParameters> </asp:SqlDataSource>

 

Any help wpuld be greatly appreciated.  I've read many posts on the Developer Network, but none actually listed an answer.

 

Thanks,

Conrad

All times are GMT -5. The time now is 2:17 AM.
Previous Next