Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

C# & MySql & Crystal Reports

[es] :: .NET :: .NET Desktop razvoj :: C# & MySql & Crystal Reports

[ Pregleda: 1437 | Odgovora: 4 ]

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Vertyg01
Banjaluka

Član broj: 39881
Poruke: 41
*.broadband.blic.net.

ICQ: 35878878


Profil

icon C# & MySql & Crystal Reports23.03.2005. u 23:47

Imam mali problemcic prilikom kreiranja "crystal report"-a u c#.
code je sledeci:

data1 = new DataSet();
da = new MySqlDataAdapter();
sqlCommand="Select uid,id,kolicina from baza";
da.SelectCommand= new MySqlCommand(sqlCommand,conne);
da.Fill(data1,"baza");
rp = new ReportDocument();
rp.Load(Environment.CurrentDirectory+@"\..\..\CrystalReport1.rpt");
rp.SetDataSource(data1);
crystalReportViewer1.ReportSource=rp;

sve super znaci loduje se CrystalReport1.rpt ali ne dobijam nikakav rezultat, pretrazio sam malo forum i bilo je reci da se treba napraviti poseban query unutar reporta (?!).
Sta tacno treba da uradim da bi dobio ispis na cr-u ?

Hvala.
23.03.2005. u 23:47 

mirdraal
Ivan Mladenovic
Tigar A.D. / Programer
Juzno ...

Član broj: 38001
Poruke: 76
195.252.107.*



Profil

icon Re: C# & MySql & Crystal Reports24.03.2005. u 08:03
Citat:
Vertyg01: Imam mali problemcic prilikom kreiranja "crystal report"-a u c#.
code je sledeci:

data1 = new DataSet();
da = new MySqlDataAdapter();
sqlCommand="Select uid,id,kolicina from baza";
da.SelectCommand= new MySqlCommand(sqlCommand,conne);
da.Fill(data1,"baza");
rp = new ReportDocument();
rp.Load(Environment.CurrentDirectory+@"\..\..\CrystalReport1.rpt");
rp.SetDataSource(data1);
crystalReportViewer1.ReportSource=rp;

sve super znaci loduje se CrystalReport1.rpt ali ne dobijam nikakav rezultat, pretrazio sam malo forum i bilo je reci da se treba napraviti poseban query unutar reporta (?!).
Sta tacno treba da uradim da bi dobio ispis na cr-u ?

Hvala.


Ne vidim u kodu da utvaraš konekciju na bazu
Dakle pre da.fill(... )
treba jedno conne.open()
pa posle toga
conne.close()

Ako kaniš pobijediti , ne smiješ izgubiti.
24.03.2005. u 08:03 

mmix
Miljan Mitrovic
Software Architect
Pancevo, Srbija

Moderator
Član broj: 17944
Poruke: 1825
*.logic.bm.



Profil

icon Re: C# & MySql & Crystal Reports24.03.2005. u 15:13
Citat:
mirdraal: Ne vidim u kodu da utvaraš konekciju na bazu
Dakle pre da.fill(... )
treba jedno conne.open()
pa posle toga
conne.close()

Ne treba, DataAdapter sam otvori konekciju ako je zatvorena i sam je posle zatvori.

Citat:
Vertyg01: sve super znaci loduje se CrystalReport1.rpt ali ne dobijam nikakav rezultat, pretrazio sam malo forum i bilo je reci da se treba napraviti poseban query unutar reporta (?!).
Sta tacno treba da uradim da bi dobio ispis na cr-u ?


Ne treba ti query unutar reporta ako si (kao što jesi) već prosledio samo podatke koje hoćeš da prikažeš. Probaj da posle:

crystalReportViewer1.ReportSource=rp;

dodaš

crystalReportViewer1.DataBind();

▪ "Why isn't my wireless mouse connected to the computer?" - 2008 Dumbest Technical Support Question award
▪ The word 'politics' is derived from the word 'poly', meaning 'many', and the word 'ticks', meaning 'blood sucking parasites' - Larry Hardiman
▪ If the good guy gets the girl, it's rated PG; if the bad guy gets the girl, it's rated R; and if everybody gets the girl, it's rated X
24.03.2005. u 15:13 

Vertyg01
Banjaluka

Član broj: 39881
Poruke: 41
*.broadband.blic.net.

ICQ: 35878878


Profil

icon Re: C# & MySql & Crystal Reports25.03.2005. u 11:37
@mirdraal: conn.open(); vec postoji samo nisam pastovao citav code.
@mmix: ne mogu DataBind(); ne znam zasto samo DataBindings();
25.03.2005. u 11:37 

mmix
Miljan Mitrovic
Software Architect
Pancevo, Srbija

Moderator
Član broj: 17944
Poruke: 1825
*.logic.bm.



Profil

icon Re: C# & MySql & Crystal Reports28.03.2005. u 15:38
Citat:
Vertyg01:@mmix: ne mogu DataBind(); ne znam zasto samo DataBindings();


Zato što koristiš WinForms, što nije bilo očigledno iz pitanja. Ok, nešto definitivno nije u redu pošto je kod koji si okačio dovoljan da prikaže report. Probaj da uradiš sledeće pre nego što report ubaciš u viewer:

Code:

rp.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, @"c:\test.pdf");


Posle pogledaj da li postoji c:\test.pdf i da li je u njemu ispravan report, pa da vidimo dalje.


▪ "Why isn't my wireless mouse connected to the computer?" - 2008 Dumbest Technical Support Question award
▪ The word 'politics' is derived from the word 'poly', meaning 'many', and the word 'ticks', meaning 'blood sucking parasites' - Larry Hardiman
▪ If the good guy gets the girl, it's rated PG; if the bad guy gets the girl, it's rated R; and if everybody gets the girl, it's rated X
28.03.2005. u 15:38 

[es] :: .NET :: .NET Desktop razvoj :: C# & MySql & Crystal Reports

[ Pregleda: 1437 | Odgovora: 4 ]

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.