0
I tried using Report Viewer, but the data from Tablix is blank
reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("Tablix1", NCategoria.Mostrar()));
Business Layer
Report Viewer
Column name:
Data Layer
public DataTable Mostrar()
{
DataTable DtResultado = new DataTable("categoria");
SqlConnection SqlCon = new SqlConnection();
try
{
SqlCon.ConnectionString = Conexao.Cn;
SqlCommand SqlCmd = new SqlCommand();
SqlCmd.Connection = SqlCon;
SqlCmd.CommandText = "spmostrar_categoria";
SqlCmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter sqlDat = new SqlDataAdapter(SqlCmd);
sqlDat.Fill(DtResultado);
}
catch
{
DtResultado = null;
}
return DtResultado;
}
Dude didn’t work out, until that line I get the information http://prntscr.com/gvevtp
– Rickafds
In their
Tablix
put the same column name is in the database. Category = Id_categoria, Description = Desc_categoria. Try to post the code instead of the screen print, it is easier to identify the error. The print hid an important part of the code– Agnaldo
Dude, I’ve tried it many ways and I still can’t, I updated the topic
– Rickafds
In the Load code you entered in parentheses**("Tablix1", Ncategoria.Show()**, where the table is(Here it is worth noting that I use a Collection and not a Datatable). Another very important thing is that you debug with breakpoint to check if Datatable is coming).
– Agnaldo