Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Crystal Reports Error

Author  Topic 

Ragabash
Starting Member

6 Posts

Posted - 2008-01-29 : 03:41:32
I made a new crystal report that get data form the database but when I check in the report to the online server I get a ADO.NET connection error
Can anyone explain it?

anuksundar
Starting Member

4 Posts

Posted - 2008-02-21 : 08:02:39
this is the way to prepare a
Sample report

For the given database in sql server say (book details) following are the fields

Book details ->bookdet

Book code ->bcode->int
Book Name->bname->varchar(30)
Book price -> bprice -> numeric(10,2)

A report is prepared for the above details

II design a form

Add a new item ->report_book.cs
Inside the form add a crystal report viewer from tool box


III write the following code in report_book.cs

Using system.data;
Using system.data.sqlclient;

Namespace publisher
{
Public class report_author
{
//instantiate the below
Conne…… con
Commandbuilder…. cmd
Data adapter….dr
Data table…..mtable

Private bookreport cr = new bookreport(); // instantiate the name of the rpt file

Static void main()
{
Application.run(new report_book());
}
}
}






iV write the following code in load()

private void report_book _load()
{
Con.connectionstring = …..
Con.open();
Dr = ….
Com = ….
Dr.fill(mtable);
Cr.setdatasource(mtable);
Crbook . reportsource = cr; // crbook-> the name given to crystal report viewer
}
}
}

V create a standart report(*.rpt)

1. go to solution explorer
2. go to add new item
3. select crystal report & name as (bookreport.rpt)
4. select open
5. press register later
6. select standard
7. select ok
8. a standard report expert will be displayed
9. go to ADO & press(+)
10. select provider for sql
11. select next
12. select database
13. select finish
14. in ado the table will be added with fields
15. select bookdet
16. select insert table
17. add the necessary fields
18. press finish
19. run the program
20. & u can change the color, formula, give column headings, page header, page footer etc



anuradhak
Go to Top of Page
   

- Advertisement -