OracleDependency OnChange event fires repetedly - asp.net

On page load i called OracleDependency object. Its working perfect when first time page loads.
means if changes occur in the tables associated with the query(some joins tables are there), than OracleDependency OnChange event fires once. which is perfect.
But when i refresh the page again and some changes done in same tables than the OracleDependency OnChange event fires two time. if refresh 3 time than onchange fires three time like that. By which i am facing some problem when it fires more than one.
I gone through the solutions of issues like that but no luck.
Code: To call On change:
private DataTable CaseListNotification(Int64 appId, Int64 personId, string value, ref int refOpenCases, ref int refMyCases, ref int refPriorityCases, ref int refEta, string isClosedShow, string isOnholdShow)
{
OracleDependency oracleDependency = null;
//oracleConnection.Open();
OracleCommand oracleCommand = null;
OracleConnection oracleConnection = null;
OracleParameter appIdParamIn = null;
OracleParameter personIdParamIn = null;
OracleParameter casesCursorParamOut = null;
OracleParameter openCasesParam = null;
OracleParameter myCasesParam = null;
OracleParameter highPriorityCasesParam = null;
OracleParameter etaCasesParam = null;
OracleParameter isShowClosedParam = null;
OracleParameter isShowOnHoldParam = null;
DataTable dataTable = new DataTable();
try
{
oracleConnection = Connection.GetGeneralConnection();
oracleCommand = new OracleCommand("Data.get_data_list", oracleConnection);
oracleCommand.CommandType = CommandType.StoredProcedure;
appIdParamIn = new OracleParameter("p_app_id", OracleDbType.Int32, ParameterDirection.Input);
oracleCommand.Parameters.Add(appIdParamIn).Value = appId;
personIdParamIn = new OracleParameter("p_pe_id", OracleDbType.Int32, ParameterDirection.Input);
oracleCommand.Parameters.Add(personIdParamIn).Value = personId;
isShowClosedParam = new OracleParameter("p_isShow_Closed", OracleDbType.Varchar2, 1, null, ParameterDirection.Input);
oracleCommand.Parameters.Add(isShowClosedParam).Value = isClosedShow;
isShowOnHoldParam = new OracleParameter("p_isShow_OnHold", OracleDbType.Varchar2, 1, null, ParameterDirection.Input);
oracleCommand.Parameters.Add(isShowOnHoldParam).Value = isOnholdShow;
openCasesParam = CommonFunction.CreateInt32OracleParam("o_open_cases", oracleCommand, null, ParameterDirection.Output);
myCasesParam = CommonFunction.CreateInt32OracleParam("o_my_cases", oracleCommand, null, ParameterDirection.Output);
highPriorityCasesParam = CommonFunction.CreateInt32OracleParam("o_high_priority", oracleCommand, null, ParameterDirection.Output);
etaCasesParam = CommonFunction.CreateInt32OracleParam("o_eta", oracleCommand, null, ParameterDirection.Output);
casesCursorParamOut = new OracleParameter("o_case_list", OracleDbType.RefCursor);
casesCursorParamOut.Direction = ParameterDirection.Output;
oracleCommand.Parameters.Add(casesCursorParamOut);
if (value == "notification")
{
oracleCommand.Notification = null;
oracleDependency = new OracleDependency(oracleCommand);
oracleDependency.OnChange += new OnChangeEventHandler(dependency_OnChange);
oracleCommand.Notification.IsNotifiedOnce = false;
oracleCommand.AddRowid = true;
}
OracleDataAdapter oracleDataAdapter = new OracleDataAdapter(oracleCommand);
oracleDataAdapter.Fill(dataTable);
if (openCasesParam.Value != null)
refOpenCases = Convert.ToInt32(((Oracle.DataAccess.Types.OracleDecimal)(openCasesParam.Value)).Value);
if (myCasesParam.Value != null)
refMyCases = Convert.ToInt32(((Oracle.DataAccess.Types.OracleDecimal)(myCasesParam.Value)).Value);
if (highPriorityCasesParam.Value != null)
refPriorityCases = Convert.ToInt32(((Oracle.DataAccess.Types.OracleDecimal)(highPriorityCasesParam.Value)).Value);
if (etaCasesParam.Value != null)
refEta = Convert.ToInt32(((Oracle.DataAccess.Types.OracleDecimal)(etaCasesParam.Value)).Value);
Connection.ReleseGeneralConnection(oracleConnection);
return dataTable;
}
catch (Exception ex)
{
throw ex;
}
}
OnChange Method :
private void dependency_OnChange(object sender, OracleNotificationEventArgs e)
{
OracleDependency dependency = sender as OracleDependency;
// NOTE: the following code uses the normal .Net capitalization methods, though
// the forum software seems to change it to lowercase letters
dependency.OnChange -= new OnChangeEventHandler(dependency_OnChange);
new GetRecordsHub().ShowRecords();
}
Procedures:
PROCEDURE get_data_list(p_app_id in t_id,
p_pe_id in t_id,
p_isShow_Closed in t_name,
p_isShow_OnHold in t_name,
o_open_cases out t_id,
o_my_cases out t_id,
o_high_priority out t_id,
o_eta out t_id,
o_case_list out sys_refcursor) IS C_FUN CONSTANT t_name :='get_data_list';
BEGIN
OPEN o_case_list for
SELECT distinct ca.ca_id, ca.ca_number as CaseNumber,
cud.cud_name AS Customer, lod.lde_name AS Location,
ca.ca_summary AS Subject, pe.pe_first_name ||' ' || pe.pe_last_name AS Owner,
te.txt_display_text AS Type, ca.ca_created_date AS CreatedDate,
ca.ca_created_date AS CreatedDateForNotification,
ca.ca_updated_date AS UpdatedDate, ca.ca_updated_date AS
UpdatedDateForNotification, dr.pe_first_name ||' ' || dr.pe_last_name AS
Driver, ops.pe_first_name ||' ' || ops.pe_last_name AS OpsManager,
tepr.txt_display_text AS Priority, tere.txt_display_text AS CaseReason,
(select count(caco_id) from wb_case_comments where CACO_CA_ID = ca.ca_id)
as CmmentCounts,
(SELECT caco_comments FROM wb_case_comments
WHERE caco_id=(select max(caco_id)
from wb_case_comments
where CACO_CA_ID = ca.ca_id and
caco_app_id = p_app_id)
) as LatestComments
FROM wb_cases ca, cu_customers cud,cu_locations lo,
cu_location_dsls lod,cu_persons pe,cu_persons dr,cu_persons ops,
di_texts te,di_texts tepr,di_texts tere
where ca.ca_app_id = cud.cud_app_id AND
ca.ca_cu_id = cud.cud_cu_id and
cud.cud_is_active = 1 AND ca.ca_lo_id = lo.lo_id(+)
AND lo.lo_id = lod.lde_lo_id(+) AND
ca.ca_pe_id_owner = pe.pe_id(+) AND
ca.ca_pe_id_driver = dr.pe_id(+) AND
ca.ca_pe_id_opsmanager = ops.pe_id(+) AND
ca.ca_iv_code_status = te.txt_code(+) AND
ca.ca_iv_code_severity = tepr.txt_code(+) AND
ca.ca_iv_code_reason = tere.txt_code(+) and
ca.ca_app_id = p_app_id and lo.lo_app_id = p_app_id
and lod.lde_app_id = p_app_id and pe.pe_app_id = p_app_id
and dr.pe_app_id = p_app_id and te.txt_app_id = p_app_id
and tepr.txt_app_id = p_app_id and tere.txt_app_id = p_app_id
order by ca.ca_id desc;
Please help.

Related

ASP.net Chart Vertical Line for Date which is on X Axis

I have implemented a RangeBar for a Gantt style chart with data from SQL Server:
mySelectQuery = "SELECT [DateTime] as StartDate, DATEADD(Day, [Time], [DateTime]) as EndDate, [Type] FROM [TaskTrack] WHERE [User] = '" + User.Identity.Name + "' AND DATEADD(Day, [Time], [DateTime]) >= getdate() ORDER BY [DateTime]";
string connStr = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
SqlConnection conn = new SqlConnection(connStr);
DataSet ds = new DataSet();
dynamic adapter = new SqlDataAdapter(mySelectQuery, conn);
conn.Open();
adapter.Fill(ds);
Chart1.DataSource = ds;
Chart1.Series["Series1"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.RangeBar;
Chart1.Series["Series1"].Label = "";
Chart1.Series["Series1"].XValueMember = "Type";
Chart1.Series["Series1"].YValueMembers = "StartDate,EndDate";
Chart1.Series["Series1"].ToolTip = "#VALY : #VALX";
Chart1.Series["Series1"].SmartLabelStyle.Enabled = true;
Chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Enabled = false;
Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
Chart1.DataBind();
conn.Close();
This works really well but along the X Axis are dates and I would like to have a vertical red line pointing up to denote todays date so that when looking at the chart it gives a good indication of when today is and what is to be done for the future.
Does anyone have an example of how to do this?
So if anyone is getting this issue in the future, I found a solution that works for me:
mySelectQuery = "SELECT [DateTime] as StartDate, DATEADD(Day, [Time], [DateTime]) as EndDate, [Type] FROM [TaskTrack] WHERE [User] = '" + User.Identity.Name + "' AND DATEADD(Day, [Time], [DateTime]) >= getdate() ORDER BY [DateTime]";
string connStr = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
SqlConnection conn = new SqlConnection(connStr);
DataSet ds = new DataSet();
dynamic adapter = new SqlDataAdapter(mySelectQuery, conn);
conn.Open();
adapter.Fill(ds);
Chart1.DataSource = ds;
Chart1.Series["Series1"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.RangeBar;
Chart1.Series["Series1"].Label = "";
Chart1.Series["Series1"].XValueMember = "Type";
Chart1.Series["Series1"].YValueMembers = "StartDate,EndDate";
Chart1.Series["Series1"].ToolTip = "#VALY : #VALX";
Chart1.Series["Series1"].SmartLabelStyle.Enabled = true;
Chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Enabled = false;
Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
VerticalLineAnnotation VA;
ChartArea CA;
CA = Chart1.ChartAreas[0];
VA = new VerticalLineAnnotation();
VA.AxisX = CA.AxisX;
VA.AxisY = CA.AxisY;
VA.IsInfinitive = true;
VA.ClipToChartArea = CA.Name;
VA.Name = "myLine";
VA.ToolTip = DateTime.Now.ToString("dd-MM-yyyy");
VA.Height = CA.AxisY.Maximum - CA.AxisY.Maximum;
VA.IsInfinitive = true;
VA.ClipToChartArea = CA.Name;
VA.LineColor = Color.Red;
VA.LineWidth = 2; // use your numbers!
VA.X = DateTime.ParseExact(DateTime.Now.ToString("dd-MM-yyyy"), "dd-MM-yyyy", null).ToOADate();
Chart1.Annotations.Add(VA);
Chart1.DataBind();
conn.Close();

Exit ListView Update Mode after clicking button

I currently am using a listview to edit and update data. When I click edit it goes into the edit format that I want it to. I want to be able to exit the entire edit mode after the update button is clicked. Is this possible?
When I use ListView1.EditIndex = -1 it doesn't go back to the regular view.
protected void ListView1_ItemUpdating(object sender, ListViewUpdateEventArgs e)
{
updateButton = true;
ListViewItem lvl = ListView1.Items[e.ItemIndex];
var formTitleListBox = (ListBox)lvl.FindControl("ListBox1");
var controlTypeListBox = (ListBox)lvl.FindControl("ControlType");
var formSectionListBox = (ListBox)lvl.FindControl("formsection");
var sortOrderTextBox = (TextBox)lvl.FindControl("SortOrderTextBox");
var subsectionListBox = (ListBox)lvl.FindControl("subsection");
var subSectionTextBox = (TextBox)lvl.FindControl("SubSectionOrderTextBox");
var sectionItemListBox = (ListBox)lvl.FindControl("sectionitem");
var sectionSortOrderTextBox = (TextBox)lvl.FindControl("SectionSortOrderTextBox");
var validationRuleListBox = (ListBox)lvl.FindControl("RuleDesc");
var crossItemListBox = (ListBox)lvl.FindControl("CrossItem");
var hiddenID = (HiddenField)lvl.FindControl("HiddenPrimaryID");
using (SqlConnection connection = new SqlConnection("Data Source=RCK-HRSA-DB01;Initial Catalog=ORHP_Dev03182014;User ID=ohitrural;Password=0h!trural"))
{
try
{
SqlCommand cmd1 = new SqlCommand("UPDATE ORHP_Dev03182014.Core.Form_Section_SubSection_Item_Rel SET FormID = #FormTitle, FormSectionID = #FormSection, SubSectionID = #SubSection, SectionItemID = #SectionItem, SortOrder = #SortOrder, SectionSortOrder = #SectionSortOrder, SubSectionSortOrder = #SubSectionSortOrder, ValidationRulesetId = #RuleDesc, ControlTypeID = #ControlType, CrossItemID = #CrossItem WHERE DataCollectionPeriodID = " + DropDownList2.SelectedValue + " AND FormSectionSubSectionItemRelID = #FormSectionSubSectionID");
connection.Open();
cmd1.Connection = connection;
cmd1.CommandType = CommandType.Text;
cmd1.Parameters.AddWithValue("#FormTitle", formTitleListBox.SelectedValue);
cmd1.Parameters.AddWithValue("#ControlType", DbNullIfNull(controlTypeListBox.SelectedValue));
cmd1.Parameters.AddWithValue("#FormSection", formSectionListBox.SelectedValue);
cmd1.Parameters.AddWithValue("#SortOrder", DbNullIfNull(sortOrderTextBox.Text));
cmd1.Parameters.AddWithValue("#SubSection", subsectionListBox.SelectedValue);
cmd1.Parameters.AddWithValue("#SubSectionSortOrder", DbNullIfNull(subSectionTextBox.Text));
cmd1.Parameters.AddWithValue("#SectionItem", sectionItemListBox.SelectedValue);
cmd1.Parameters.AddWithValue("#SectionSortOrder", DbNullIfNull(sectionSortOrderTextBox.Text));
cmd1.Parameters.AddWithValue("#RuleDesc", DbNullIfNull(validationRuleListBox.SelectedValue));
cmd1.Parameters.AddWithValue("#CrossItem", DbNullIfNull(crossItemListBox.SelectedValue));
cmd1.Parameters.AddWithValue("#FormSectionSubSectionID", hiddenID.Value);
cmd1.ExecuteNonQuery();
SqlDataAdapter dt = new SqlDataAdapter(cmd1);
DataSet ds = new DataSet();
searchDS = new DataSet();
dt.Fill(ds);
searchDS = ds;
UpdatePanel1.Update();
ListView1.DataSource = searchDS;
ListView1.EditIndex = -1;
ListView1.DataBind();
e.Cancel = true;
}
catch (Exception ex)
{
}
}
}
Add ListView1.DataBind(); and also e.Cancel = true;.
// ...
cmd1.ExecuteNonQuery();
ListView1.EditIndex = -1;
ListView1.DataBind()
e.Cancel = true;
// ...
Side-note: remove the empty catch if you want to notice if something goes wrong.

Argument of Out Range Exception while trying to read data from a List

I have a method that reads data from a database table using SqlDataReader.
i assign data retrieved by SqlDataReader into a List and return it.
when i want to assign the List data from method into the List on Code behind file,
i encounter the following error:
and here is my code
public List<string> displayCustoemrhShipOrder()
{
List<string> drList = new List<string>();
int i = 0;
string sConnectionString = ConfigurationManager.ConnectionStrings["LGDB"].ToString();
SqlConnection SqlCOn = new SqlConnection(sConnectionString);
SqlCommand SqlCmd = new SqlCommand();
SqlCmd.Connection = SqlCOn;
SqlCmd.CommandText = "displayCustomerShipOrder";
SqlCmd.CommandType = CommandType.StoredProcedure;
SqlCOn.Open();
SqlCmd.Parameters.AddWithValue("ShipOrderID",shipOrderID);
SqlDataReader reader = SqlCmd.ExecuteReader();
while (reader.Read())
{
drList.Insert(i, reader.GetValue(i).ToString());
i++;
}
//reader.Close();
//sqlCon.Close();
reader.Dispose();
SqlCOn.Dispose();
return (drList);
}
code behind code:
protected void Page_Load(object sender, EventArgs e)
{
// string shipOrderID = Session["shipOrderID"].ToString();
// int ID = Convert.ToInt32(shipOrderID);
int ID = 700;
Classes.CustomerShipOrder cuShipOrder = new Classes.CustomerShipOrder(ID);
List<string> ordrList = new List<string>(16);
ordrList= cuShipOrder.displayCustoemrhShipOrder();
cuid.Text = ordrList[0];
Label2.Text = ordrList[1];
Label3.Text = ordrList[2];
Label4.Text = ordrList[3];
Label5.Text = ordrList[4];
Label6.Text = ordrList[5];
Label7.Text = ordrList[6];
Label8.Text = ordrList[7];
Label9.Text = ordrList[8];
Label10.Text = ordrList[9];
Label11.Text = ordrList[10];
stored procedure used :
#ShipOrderID int
as
begin
select * from customerShipOrder where shipOrderID = #ShipOrderID;
end

Unable to pass parameters to SSRS report in ASP.NET page

Hi I am getting an error in supplying parameters to an SSRS report deployed on server in ASP.NET page.
Please refer to the code below and let me know where is the issue?
ReportExecutionService rs = new ReportExecutionService();
string rptURL = System.Configuration.ConfigurationManager.AppSettings["rptURL"].ToString();
string rptPath = System.Configuration.ConfigurationManager.AppSettings["Page1SLScorecardReortForDownload"].ToString();
//Microsoft.Reporting.WebForms.ReportParameter[] paramlist = new Microsoft.Reporting.WebForms.ReportParameter[3];
//paramlist[0] = new Microsoft.Reporting.WebForms.ReportParameter("Week", "2013-05-03");
//paramlist[1] = new Microsoft.Reporting.WebForms.ReportParameter("year", "Fiscal Calendar 2013");
//paramlist[2] = new Microsoft.Reporting.WebForms.ReportParameter("Month", "Fiscal May, 2013");
ParameterValue[] paramlist = new ParameterValue[3];
//Microsoft.Reporting.WebForms.ReportParameter[] paramlist = new Microsoft.Reporting.WebForms.ReportParameter[3];
paramlist[0] = new ParameterValue();
paramlist[0].Name = "Week";
paramlist[0].Value = "2013-05-03";
paramlist[1] = new ParameterValue();
paramlist[1].Name = "year";
paramlist[1].Value = "Fiscal Calendar 2013";
paramlist[2] = new ParameterValue();
paramlist[2].Name = "Month";
paramlist[2].Value = "Fiscal May, 2013";
//ReportViewer1.ServerReport.SetParameters(paramlist);
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
rs.Url = rptURL;
byte[] result = null;
string reportPath = rptPath;
string format = "EXCEL";
string historyID = null;
string devInfo = #"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";
string encoding;
string mimeType;
string extension;
ReportingWS.Warning[] warnings = null;
string[] streamIDs = null;
ReportingWS.ExecutionInfo execInfo = new ReportingWS.ExecutionInfo();
ReportingWS.ExecutionHeader execHeader = new ReportingWS.ExecutionHeader();
rs.ExecutionHeaderValue = execHeader;
execInfo = rs.LoadReport(reportPath, historyID);
rs.SetExecutionParameters(paramlist, "en-us");
String SessionId = rs.ExecutionHeaderValue.ExecutionID;
try
{
result = rs.Render(format, devInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);
execInfo = rs.GetExecutionInfo();
}
catch (Exception ex)
{
//AlnErrorHandler.HandleError(ex);
}
parameters.Add(new ReportParameter("FyId", Convert.ToInt16(objSession.FyId).ToString()));
parameters.Add(new ReportParameter("AccountGroupId", cmbAccountGroup.SelectedValue));
parameters.Add(new ReportParameter("LedgerId", cmbLedgerId.SelectedValue));
rptvwMain.ServerReport.SetParameters(parameters);
Pass Parameters like this....

Stored procedure executing but not able to access data in asp.net

I have a stored procedure that executes perfectly in SQL Server. However I am not able to access the rows that are return by it in asp.net from Data Access Layer
My DataAccessLayer code is as follows:
public List<AdvancePaymentRep> getPaymentAdvanceData(int? InternalCompany = 0, string Currency = "", DateTime? InvoiceDateFrom = null, DateTime? InvoiceDateTo = null, DateTime? AdvDateDueFrom = null, DateTime? AdvDateDueTo = null)
{
CreateConnectionString();
List<AdvancePaymentRep> paymentAdvanceCollection = new List<AdvancePaymentRep>();
SqlDataReader rdrval = null;
SqlCommand command1 = sqlConnection.CreateCommand();
command1.CommandType = System.Data.CommandType.StoredProcedure;
command1.CommandText = "[dbo].[NST_GetDataForAdvancePaymentReport]";
if (InternalCompany != 0)
{
SqlParameter parametersInternalCompany = new SqlParameter();
parametersInternalCompany.ParameterName = "#AlhInternalCie";
parametersInternalCompany.SqlDbType = System.Data.SqlDbType.Int;
parametersInternalCompany.Direction = ParameterDirection.Input;
parametersInternalCompany.Value = InternalCompany;
command1.Parameters.Add(parametersInternalCompany);
}
SqlParameter parametersCurrency = new SqlParameter();
parametersCurrency.ParameterName = "#AlhCurrency";
parametersCurrency.SqlDbType = System.Data.SqlDbType.NVarChar;
parametersCurrency.Direction = ParameterDirection.Input;
parametersCurrency.Value = Currency;
command1.Parameters.Add(parametersCurrency);
if (InvoiceDateFrom != Convert.ToDateTime("01/01/0001 00:00:00"))
{
SqlParameter parametersInvoiceDateFrom = new SqlParameter();
parametersInvoiceDateFrom.ParameterName = "#AldDtCreatedFrom";
parametersInvoiceDateFrom.SqlDbType = System.Data.SqlDbType.Date;
parametersInvoiceDateFrom.Direction = ParameterDirection.Input;
parametersInvoiceDateFrom.Value = InvoiceDateFrom;
command1.Parameters.Add(parametersInvoiceDateFrom);
}
if (InvoiceDateTo != Convert.ToDateTime("01/01/0001 00:00:00"))
{
SqlParameter parametersInvoiceDateTo = new SqlParameter();
parametersInvoiceDateTo.ParameterName = "#AldDtCreatedTo";
parametersInvoiceDateTo.SqlDbType = System.Data.SqlDbType.Date;
parametersInvoiceDateTo.Direction = ParameterDirection.Input;
parametersInvoiceDateTo.Value = InvoiceDateTo;
command1.Parameters.Add(parametersInvoiceDateTo);
}
if (AdvDateDueFrom != Convert.ToDateTime("01/01/0001 00:00:00"))
{
SqlParameter parametersInvoiceDateDueFrom = new SqlParameter();
parametersInvoiceDateDueFrom.ParameterName = "#InvhDtDueFrom";
parametersInvoiceDateDueFrom.SqlDbType = System.Data.SqlDbType.Date;
parametersInvoiceDateDueFrom.Direction = ParameterDirection.Input;
parametersInvoiceDateDueFrom.Value = AdvDateDueFrom;
command1.Parameters.Add(parametersInvoiceDateDueFrom);
}
if (AdvDateDueTo != Convert.ToDateTime("01/01/0001 00:00:00"))
{
SqlParameter parametersInvoiceDateDueTo = new SqlParameter();
parametersInvoiceDateDueTo.ParameterName = "#InvhDtDueTo";
parametersInvoiceDateDueTo.SqlDbType = System.Data.SqlDbType.Date;
parametersInvoiceDateDueTo.Direction = ParameterDirection.Input;
parametersInvoiceDateDueTo.Value = AdvDateDueTo;
command1.Parameters.Add(parametersInvoiceDateDueTo);
}
try
{
if (sqlConnection == null)
{
sqlConnection.Open();
}
rdrval = command1.ExecuteReader(); // Getting HasRows = false out here
EDIT : Have solved the issue there was some problem with how i had supplied the
The last command in your SP should be a SELECT command. Else, you get other results such as the number of rows affected and such. Management Studio is still able to display rows created from one of the SELECTs in your SP but actually they are not the first "thing" that is returned when you call an ADO.NET command against that SP.
After your
rdrval = command1.ExecuteReader();
You'll need to do something like
while (rdrval.Read())
{
//do something
}

Resources