-1
我寫這個代碼的動態填充:一個RDLC
namespace ImportarAlamo
{
public partial class RelIndi : Form
{
public RelIndi()
{
InitializeComponent();
}
private void RelIndi_Load(object sender, EventArgs e)
{
reportViewer1.Visible = false;
}
private void button1_Click(object sender, EventArgs e)
{
reportViewer1.Visible = true;
reportViewer1.Reset();
fillrel();
// Here is the part to populate the report :
ReportDataSource DS = new ReportDataSource("individual2",fillrel());
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.ReportPath = @"C:\relatorios\Report8.rdlc";
reportViewer1.LocalReport.DataSources.Add(DS);
reportViewer1.LocalReport.Refresh();
}
public DataSet fillrel()
{
DataSet uny = new DataSet();
SqlConnection abre = Tconex.GetConnection();
SqlDataAdapter da2 = new SqlDataAdapter();
SqlCommand llena = new SqlCommand("rel_Noparam", abre);
llena.CommandType = CommandType.StoredProcedure;
da2.SelectCommand = llena;
da2.Fill(uny,"rel");
abre.Close();
return uny;
}
的report8.rdlc什麼都沒有,現在的代碼有沒有錯誤,但我可以把一個表矩陣上的報告,我怎麼顯示的字段???
我必須解決這個問題,現在我如何填充的報告? – 2013-03-21 18:28:15
你對**填充**有什麼意義? *這裏的代碼是填充報告的部分... *是你需要的所有 – 2013-03-21 18:32:10
哦,我看到你編輯。你沒有設計你的報告嗎?如果您不這樣做,請查看http://msdn.microsoft.com/en-us/library/bb934258(v=sql.100).aspx – 2013-03-21 18:33:06