Click here to Skip to main content
15,305,136 members

Comments by Member 11933161 (Top 11 by date)

Member 11933161 8-Nov-17 3:09am View
   
Okay.. Thank you so much.
Member 11933161 8-Nov-17 3:05am View
   
Hi, thank you for the reply. Upgrading to VS 2017 will have any effect on SQL Server?? Because right now I am using SQL Server-14. For my office work, i have to use SQL-server 14 only. Can you please clear my doubt?
Member 11933161 30-Jun-17 6:04am View
   
Thank you for the observation. I feel, i have problem with the views that i have created.
Member 11933161 30-Jun-17 1:17am View
   
Iam binding the seller names to dropdown from Company master
Member 11933161 30-Jun-17 1:17am View
   
Hello sir,
In the report that is generating, i have field called seller name.. I want to display the name of the seller. Ex-Abhi.. But right now it its displaying the SlNo of the seller that is stored in the db.. Ex-4.
I tried the code that u have sent
string dropDownText = DropList.SelectedItem.Text.ToString();. But still getting error at " int seller = int.Parse(ViewState["SELLER"].ToString());" as " Input string was not in a correct format."
Member 11933161 28-Jun-17 6:21am View
   
Actually, there is a master called company. & seller is derived from that company master. I have a web page with seller drop down.. When i click that drop-down i can see the names of the seller companies. But when i submit, i can see only the SlNo of the sellers in the report.. I want to display the names of the sellers in the report.
Member 11933161 28-Jun-17 4:30am View
   
Thanks for the reply.. I will tell my issue in deep.
I have written the following code in Reportviewer.aspx.cs page:
ViewState["FROM"] = Request["FROM"].ToString();
ViewState["TO"] = GetString(Request["TO"].ToString());

ViewState["SELLER"] =Request["SELLER"].ToString();

string fDate = ViewState["FROM"].ToString();
string toDate = ViewState["TO"].ToString();

int seller = int.Parse(ViewState["SELLER"].ToString()); //i am getting error here as "Input string was not in a correct format.".//

DateTime from = Convert.ToDateTime(fDate);
fDate = from.ToString("yyyy-MM-dd");

DateTime to = Convert.ToDateTime(toDate);
toDate = to.ToString("yyyy-MM-dd");

string lstrConn = System.Configuration.ConfigurationManager.ConnectionStrings["SQLConnString"].ToString();


SqlConnection conn = new SqlConnection(lstrConn);
conn.Open();
string sql = "Select * FROM V_DemoRep ";

//if (seller > 0)
// sql = sql + " sellername " + seller;

SqlDataAdapter ad = new SqlDataAdapter(sql, conn);
DataSet ds = new DataSet();
ad.Fill(ds);

//ReportViewer2.ProcessingMode = ProcessingMode.Local;
////set path of the Local report
//ReportViewer2.LocalReport.ReportPath = Server.MapPath("~/rptVOrder.rdlc");

ReportDataSource rds = new ReportDataSource("DataSet1", ds.Tables[0]);
ReportViewer1.Width = Unit.Pixel(1200);
ReportViewer1.Height = Unit.Pixel(700);


ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();

& i have written code in tripreport.aspx.cs page:
private void pBindDDL()
{
DataTable dtFTLInfo = BuyerSellerTranAccept.GetBySeller(myUserInfo.Company.SlNo);

ddlSeller.Items.Clear();
ddlSeller.DataSource = dtFTLInfo;
ddlSeller.DataValueField = "slno";
ddlSeller.DataTextField = "Name";

ddlSeller.DataBind();
ddlSeller.Items.Insert(0, new ListItem("--Select--", "0"));
}
protected void Page_ResetButton(object sender, EventArgs e)
{
pClearControl();
}
private void pClearControl()
{

txtFromDate.Text = "";
txtToDate.Text = "";

}
protected void Page_SubmitButton(object sender, EventArgs e)
{


pShowReports();
// ViewReport(reportName, sSelectionFormula, sParameter, sFormula);
}
private void pShowReports()
{
if (myUserInfo == null) myUserInfo = (Model.Masters.SubscriberInfo)ViewState[USER_KEY];

StringBuilder sb = new StringBuilder();
sb.Append("");

// sb.Append("window.open('../Registers.aspx')");
sb.Append("window.open('TripStatusViewer.aspx?FROM=" + txtFromDate.Text + "&TO=" + txtToDate.Text + "&SELLER=" + ddlSeller.SelectedItem.Text.ToString() +"')");
// sb.Append("window.open('../Registers.aspx?ID=" + reportName + "')");
//+ "&SELFORMULA=" + sSelectionFormula + "&PARAMETER=" + sParameter + "&FORMULA=" + sFormula + "')");
sb.Append("");

if (!Page.ClientScript.IsClientScriptBlockRegistered("report"))
ScriptManager.RegisterStartupScript(btnSubmit, this.GetType(), "report", sb.ToString(), false);


}

}
}
Member 11933161 7-Jun-16 4:11am View
   
Thank you for replying. I tried by right clicking on Data Connections but got the below error
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Member 11933161 15-Dec-15 5:53am View
   
@Suvendu Shekhar Giri Thank You So Much sir.. The issue is Resolved....
Member 11933161 15-Dec-15 5:17am View
   
protected void ddlState_SelectedIndexChanged(object sender, EventArgs e)
{
int M_STATE_SLNO = Convert.ToInt16(ddlState.SelectedValue);
SqlConnection con = new SqlConnection(strConnection);
con.Open();
SqlCommand cmd = new SqlCommand("select * from M_COUNTRY where M_COUNTRY_CODE=" +M_STATE_SLNO, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
con.Close();
ddlCountry.DataSource = ds;
ddlCountry.DataTextField = "M_COUNTRY_NAME";
ddlCountry.DataValueField = "M_COUNTRY_CODE";
ddlCountry.DataBind();
ddlCountry.Items.Insert(0, new ListItem("--Select--", "0"));
ddlCountry_SelectedIndexChanged(null, null);

}
Member 11933161 15-Dec-15 5:16am View
   
Actually i did the same..But the out put was something else..
protected void ddlState_SelectedIndexChanged(object sender, EventArgs e)
{
int M_STATE_SLNO = Convert.ToInt16(ddlState.SelectedValue);
SqlConnection con = new SqlConnection(strConnection);
con.Open();
SqlCommand cmd = new SqlCommand("select * from M_COUNTRY where M_COUNTRY_CODE=" +M_STATE_SLNO, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
con.Close();
ddlCountry.DataSource = ds;
ddlCountry.DataTextField = "M_COUNTRY_NAME";
ddlCountry.DataValueField = "M_COUNTRY_CODE";
ddlCountry.DataBind();
ddlCountry.Items.Insert(0, new ListItem("--Select--", "0"));
ddlCountry_SelectedIndexChanged(null, null);

}