Click here to Skip to main content
15,889,403 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a clsSqlDBOperation.dll file added as reference in my application. it contains database based operation's functions like storedProcedureDataTable(). In his function parameters are passed from my form1's report_click event that is simple button.
Now while adding a storedProcedureDataTable() in this click event then adding its result in another dataTable then NullReference exception occurs.
Below is my code....

C#
 DBOperation.clsSQLDBOperation objDB;


DataTable dtWfReport = new DataTable();

 ArrayList arrParam = new ArrayList();
                ArrayList arrValue = new ArrayList();
                TimePeriod();
                arrParam.Add("REPORTTYPE");
                arrValue.Add(1);
                arrParam.Add("STARTDATE");
                arrValue.Add(strStartdt);
                arrParam.Add("ENDDATE");
                arrValue.Add(strEndDate);
                arrParam.Add("USERID");
                arrValue.Add(listBoxControl1.SelectedValue);

               //while debugging problem comes over the code below
                dtWfReport = objDB.storeProcedureDataTable("WF_REPORTS", arrParam, arrValue);
                for (int i = 0; i <= dtWfReport.Rows.Count - 1; i++)
                {
                    if (string.IsNullOrEmpty(dtWfReport.Rows[i].ItemArray[1].ToString()))
                    {
                        dtWfReport.Rows[i].ItemArray[1] = "check ur entries";
                        break;
                    }
                }


                //objDB.closeConnection();



                //BindChart();

                
            }
Posted
Updated 31-Jan-15 1:11am
v3
Comments
Afzaal Ahmad Zeeshan 31-Jan-15 7:19am    
Can you look for which object is Null in the code at this very stage?
Richard MacCutchan 31-Jan-15 7:24am    
Check where the error occurs and use your debugger to identify which parameter is null. In the code above it is not clear where the various parameters come from.
Arkadeep De 31-Jan-15 8:33am    
check with the actual code...if it is okay with original code then may be binding problem...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900