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

C# & MySql & Crystal Reports

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

[ Pregleda: 1638 | 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.*

Sajt: www.linkedin.com/in..


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

SuperModerator
Član broj: 17944
Poruke: 2411
*.logic.bm.

Sajt: blog.mitrovic.rs


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();

▪ The quicker a phone is answered in sales, the slower it's answered in customer
services - Brownridge's Law
▪ Democracy is a device that ensures we shall be governed no better than we deserve
- George Bernard Shaw
▪ To err is human--and to blame it on a computer is even more so - Robert Orben
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

SuperModerator
Član broj: 17944
Poruke: 2411
*.logic.bm.

Sajt: blog.mitrovic.rs


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.


▪ The quicker a phone is answered in sales, the slower it's answered in customer
services - Brownridge's Law
▪ Democracy is a device that ensures we shall be governed no better than we deserve
- George Bernard Shaw
▪ To err is human--and to blame it on a computer is even more so - Robert Orben
28.03.2005. u 15:38 

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

[ Pregleda: 1638 | Odgovora: 4 ]

Postavi temu Odgovori

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