Code is write in C# in windows forms I have button Print,which onclick must open Stimulsoft and sent dataGridView1 to Stimulsoft. How can I do it?Please help,I can not find answer on web
private void Table_Load(object sender, EventArgs e)
{
dataGridView1.DataSource = GetTable();
}
private DataTable GetTable()
{
DataTable dtRadnice = new DataTable();
using (SqlConnection conn = new SqlConnection(_csDataFin))
{
conn.Open();
SqlCommand comm = new SqlCommand("traziuEvidenciji", conn);
comm.CommandType = CommandType.StoredProcedure;
DateTime dtPocetak;
DateTime dtZavrsetak;
dtPocetak = dateTimePicker1.Value.Date;
dtZavrsetak = dateTimePicker2.Value.Date;
comm.Parameters.Add("@dtPocetak", SqlDbType.DateTime).Value = dtPocetak;
comm.Parameters.Add("@dtZavrsetak", SqlDbType.DateTime).Value = dtZavrsetak;
SqlDataReader reader = comm.ExecuteReader();
dtRadnice.Load(reader);
}
return dtRadnice;
}
private void btnPrint_Click(object sender, EventArgs e)
{
//some text
}
This is stored procedure which put data into dataGridView
ALTER PROCEDURE traziuEvidenciji
@dtPocetak datetime,
@dtZavrsetak datetime
AS
BEGIN
SELECT EvidencijaORadu.IDEvidencijaORadu
,Korisnik_s.Name
,EvidencijaORadu.DateOfMonth
,EvidencijaORadu.PocetakRada
,EvidencijaORadu.ZavrsetakRada
,EvidencijaORadu.RedovnoRadnoVrijeme
FROM EvidencijaORadu
inner join [EmmettShared].dbo.[Korisnik_s] on Korisnik_s.IDKorisnik=
EvidencijaORadu.KorisnikID
WHERE [DateOfMonth] BETWEEN CAST( @dtPocetak AS date) AND
CAST(@dtZavrsetak AS DATE)
ORDER BY DateOfMonth ASC
END
Have you checked out stimulsoft documentation? For example:
It seems you have many options to push data to Stimulsoft reports. In particular you could be interested in using the method StiReport.RegData(DataTable data)
. At least it exists based on API reference.
Also, there seems to be a bunch of videos by them in youtube. For example, check out this one Binding DataSet at Runtime - Stimulsoft Reports.