我的网站菜单栏有问题。我几乎没有编码背景。谢谢您的提前帮助。
我的网站:provedmech.com
private DataTable GetBillReport( int Sessionid)
{
System.Data.DataSet ds2 = new System.Data.DataSet();
try
{
//DataTable dt = new DataTable();
//DataTable dtSe = new DataTable();
//DataTable dtTm = new DataTable();
//DataTable dtBt = new DataTable();
string sconn = System.Configuration.ConfigurationManager.ConnectionStrings["SchoolFinanceDbContext"].ConnectionString;
using (SqlConnection conn = new SqlConnection(sconn))
{
// SqlDataAdapter adp = new SqlDataAdapter("select BPIV.Bill_Prep_Indvid, BPIV.Bill_Prepid, BPIV.Student_Classid, BPIV.RegistrationNo,"+
//"Cn.CL_Name, Cn.Class_Nameid, Se.Sessionid, Se.Session_Name, Tm.Termid, Tm.Term_Name, Bt.Bill_Typeid, Bt.Bill_Name, BPIV.Description, BPIV.Bill_Percent,"+
//"BPIV.Bill_Amount from Bill_Prep_Indv BPIV"+
//"inner join Session Se ON BPIV.Sessionid = Se.Sessionid"+
//"inner join Term Tm ON BPIV.Termid = Tm.Termid"+
//"inner join Class_Name Cn ON BPIV.Class_Nameid = Cn.Class_Nameid"+
//"inner join Bill_Type Bt ON BPIV.Bill_Typeid = Bt.Bill_Typeid"+
//"where BPIV.Sessionid = @Sessionid and BPIV.Termid = @Termid and BPIV.Bill_Typeid = @BTypeid", conn);
//SqlDataAdapter adp = new SqlDataAdapter(cmd);
SqlDataAdapter adp = new SqlDataAdapter();
adp.SelectCommand = new SqlCommand();
adp.SelectCommand.Connection = conn;
adp.SelectCommand.CommandText = "Bill_Prep_IndvRepChild";
adp.SelectCommand.CommandType = CommandType.StoredProcedure;
// Sets the productid parameter.
adp.SelectCommand.Parameters.Add((new SqlParameter("@Sessionid", SqlDbType.Int)).Value = Sessionid);
//adp.SelectCommand.Parameters.Add((new SqlParameter("@Termid", SqlDbType.Int)).Value = Termid);
//adp.SelectCommand.Parameters.Add((new SqlParameter("@BTyped", SqlDbType.Int)).Value = BillTypeid);
//adp.SelectCommand = cmd;
// ds1.Tables.Add("Bill");
adp.Fill(ds2);
// adp.Fill(ds1);
// Sets the productid parameter.
//cmd.Parameters.Add((new SqlParameter("@Sessionid", SqlDbType.Int)).Value = Sessionid);
//cmd.Parameters.Add((new SqlParameter("@Termid", SqlDbType.Int)).Value = Termid);
//cmd.Parameters.Add((new SqlParameter("@BTyped", SqlDbType.Int)).Value = BTypeid);
// SqlCommand cmd = new SqlCommand();
//adp.SelectCommand = cmd;
adp.SelectCommand.CommandTimeout = 0;
// adp.Fill(dt,"Bill");
//adp.Fill(dt);
//SqlCommand comm1 = new SqlCommand("Select * from Session", conn);
//ds1.Tables.Add("Se");
//adp.SelectCommand = comm1;
//adp.Fill(ds1.Tables["Se"]);
//SqlCommand comm2 = new SqlCommand("Select * from Term", conn);
//ds1.Tables.Add("Tm");
//adp.SelectCommand = comm2;
//adp.Fill(ds1.Tables["Tm"]);
//SqlCommand comm3 = new SqlCommand("Select * from Bill_Type", conn);
//ds1.Tables.Add("Bt");
//adp.SelectCommand = comm3;
//adp.Fill(ds1.Tables["Bt"]);
// dt..Tables.Add("Bt");
}
return ds2.Tables[0];
// return ds2.Bill_Prep_Indv;
}
catch
{
throw;
}
}
protected void reportViewer_Drillthrough(object sender, Microsoft.Reporting.WebForms.DrillthroughEventArgs e)
{
try
{
//BindingSource source = new BindingSource();
//Microsoft.Reporting.WebForms.ReportDataSource dataSrc = new Microsoft.Reporting.WebForms.ReportDataSource();
//dataSrc.Name = "DataSet1";
//dataSrc.Value = this.DataTableBindingSource;
//System.Data.DataSet ds = new System.Data.DataSet("Dataset2");
//DataTable dtBill = new DataTable("Bill");
//string sconn = System.Configuration.ConfigurationManager.ConnectionStrings["SchoolFinanceDbContext"].ConnectionString;
//var conn = new SqlConnection(sconn);
//SqlDataAdapter adp = new SqlDataAdapter();
//adp.SelectCommand = new SqlCommand();
//adp.SelectCommand.Connection = conn;
//adp.SelectCommand.CommandText = "Bill_Prep_IndvRepChildUF";
//adp.SelectCommand.CommandType = CommandType.StoredProcedure;
int Sessionid = 0;
//int Termid = 0;
//int BillTypeid = 0;
//adp.Fill(ds,"dtBill");
//TimeSpan ts = new TimeSpan(0, 0, 10);
// Cache["DsBill"] = ds1;
// Cache["DsBill"] = dtBill;
// Cache.insert("Employee", dtBill, null, Cache.NoAbsoluteExpiration, ts);
// ds = (DataTable)Cache["ds1"];
// ReportViewer reportViewer = new ReportViewer();
//Get the instance of the Target report.
LocalReport report = (LocalReport)e.Report;
// report.DataSources.Add(dataSrc);
//Get all the parameters passed from the main report to the target report.
//OriginalParametersToDrillthrough actually returns a Generic list of
//type ReportParameter.
IList<ReportParameter> list = report.OriginalParametersToDrillthrough;
//Parse through each parameters to fetch the values passed along with them.
foreach (ReportParameter param in list)
{
//Since we know the report has only one parameter and it is not a multivalued,
//we can directly fetch the first value from the Values array.
Sessionid = Convert.ToInt32(param.Values[0].ToString());
//Termid = Convert.ToInt32(param.Values[1].ToString());
//BillTypeid = Convert.ToInt32(param.Values[2].ToString());
}
//DataTable dt2 = GetBillReport(Sessionid);
report.DataSources.Add(new ReportDataSource("DataSet1", GetBillReport(Sessionid)));
// report.DataSources.Add(new ReportDataSource("DataSet1", ds1.Tables[0]));
//report.DataSources.Add(new ReportDataSource("Session", ds1.Tables[1]));
//report.DataSources.Add(new ReportDataSource("Term", ds1.Tables[2]));
//report.DataSources.Add(new ReportDataSource("BillType", ds1.Tables[3]));
//report.DataSources.Add(new ReportDataSource("Session", GetBillReport(Sessionid, Termid, BTypeid)));
//report.DataSources.Add(new ReportDataSource("Term", GetBillReport(Sessionid, Termid, BTypeid)));
//report.DataSources.Add(new ReportDataSource("BillType", GetBillReport(Sessionid, Termid, BTypeid)));
// reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Report\Report4.rdlc";
report.Refresh();
// ViewBag.ReportViewer = report;
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
菜单栏前后:
我认为问题是: