Welcome to Dream.In.Code
Getting Help is Easy!

Join 117,573 Programmers for FREE! Ask your question and get quick answers from experts. There are 2,004 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



How to display records from multiple Tables using Crystal Report in a

 
Reply to this topicStart new topic

How to display records from multiple Tables using Crystal Report in a

kamlesh
post 8 Apr, 2008 - 03:04 AM
Post #1


New D.I.C Head

*
Joined: 8 Apr, 2008
Posts: 12

[font=System]hi,


i want to use crystal reports for displaying records from multiple tables in asp.net 2.0, i know how to display records using dataset in with crystal reports.
Can anybody tell me hoe i will display records on crystal report from multiple Tables.

More Than Two. etc.

Its Urgent , pls help me

Thanks,
Kamlakar
User is offlineProfile CardPM

Go to the top of the page


JasonMcAuley
post 10 Apr, 2008 - 07:42 AM
Post #2


D.I.C Head

**
Joined: 10 Apr, 2008
Posts: 134


My Contributions


With SQL Server; I simply just call my stored procedures in Crystal Reports. With the stored procedures you can write queries that grab data from multiple tables.

Hope this helps! If you have any other questions just ask.
User is offlineProfile CardPM

Go to the top of the page

kamlesh
post 11 Apr, 2008 - 12:55 AM
Post #3


New D.I.C Head

*
Joined: 8 Apr, 2008
Posts: 12

QUOTE(JasonMcAuley @ 10 Apr, 2008 - 07:42 AM) *

With SQL Server; I simply just call my stored procedures in Crystal Reports. With the stored procedures you can write queries that grab data from multiple tables.

Hope this helps! If you have any other questions just ask.



Hi,
Thank fro reply.
Can u tel me how to write sql statements in Stored Procedure in SQL 2000.
Can u send me the code sample, how u wrote the code for displaying records from multiple tables using SP.

Tel me the Procedure.

Its Urgent , Help Me !!!

Bye,
Kamlesh
User is offlineProfile CardPM

Go to the top of the page

JasonMcAuley
post 11 Apr, 2008 - 07:37 AM
Post #4


D.I.C Head

**
Joined: 10 Apr, 2008
Posts: 134


My Contributions


CODE


CREATE PROCEDURE My_Stored_Procedure AS

Select a.UserID, a.UserName,  b.User_FontColour
From [Users] a
Inner Join User_preference b on a.UserID = b.UserID

GO




That is a simple stored procedure that will select the userID and UserName from the Users table and will select the User_FontColour from the User_preference table


You would do this in your SQL Server Enterprise manager. Open your database, right click on the stored procedures folder click "Create new stored procedure" and write your query.

When you are in crystal reports; you can then make reference to that stored procedure and it will automatically add the fields in your select statement as fields you can place on the report.


Hope that helps

This post has been edited by JasonMcAuley: 11 Apr, 2008 - 07:45 AM
User is offlineProfile CardPM

Go to the top of the page

kamlesh
post 14 Apr, 2008 - 09:51 PM
Post #5


New D.I.C Head

*
Joined: 8 Apr, 2008
Posts: 12

QUOTE(JasonMcAuley @ 11 Apr, 2008 - 07:37 AM) *

CODE


CREATE PROCEDURE My_Stored_Procedure AS

Select a.UserID, a.UserName,  b.User_FontColour
From [Users] a
Inner Join User_preference b on a.UserID = b.UserID

GO




That is a simple stored procedure that will select the userID and UserName from the Users table and will select the User_FontColour from the User_preference table


You would do this in your SQL Server Enterprise manager. Open your database, right click on the stored procedures folder click "Create new stored procedure" and write your query.

When you are in crystal reports; you can then make reference to that stored procedure and it will automatically add the fields in your select statement as fields you can place on the report.


Hope that helps

User is offlineProfile CardPM

Go to the top of the page

kamlesh
post 14 Apr, 2008 - 09:59 PM
Post #6


New D.I.C Head

*
Joined: 8 Apr, 2008
Posts: 12


Hi,

Can u send the code for Crystal Report retriving records from multiple Tables using Asp.net2.0 with C# ,Its Urgent.

Can u also send the Design of Crystal Report for selecting records from multiple Tables. My Query work in Query Analyzer but in code it onlt returns all records from Tables.

Can u show me the code exactly how to fetch the Records from multiple Tables send me the code.Help me plsssssss, Its Urgent.

Thanks,
Kamlesh.
User is offlineProfile CardPM

Go to the top of the page

kamlesh
post 17 Apr, 2008 - 05:42 AM
Post #7


New D.I.C Head

*
Joined: 8 Apr, 2008
Posts: 12

QUOTE(kamlesh @ 14 Apr, 2008 - 09:51 PM) *

QUOTE(JasonMcAuley @ 11 Apr, 2008 - 07:37 AM) *

CODE


CREATE PROCEDURE My_Stored_Procedure AS

Select a.UserID, a.UserName,  b.User_FontColour
From [Users] a
Inner Join User_preference b on a.UserID = b.UserID

GO




That is a simple stored procedure that will select the userID and UserName from the Users table and will select the User_FontColour from the User_preference table


You would do this in your SQL Server Enterprise manager. Open your database, right click on the stored procedures folder click "Create new stored procedure" and write your query.

When you are in crystal reports; you can then make reference to that stored procedure and it will automatically add the fields in your select statement as fields you can place on the report.


Hope that helps




Hi,
Thanks for Reply can u send me some code sample with Crystal Reports showing selected record from multiple Tables using C#.net and ASP.net 2.0 .

Send me pls , Its Urgent.
Bye.
User is offlineProfile CardPM

Go to the top of the page

jayman9
post 17 Apr, 2008 - 09:15 AM
Post #8


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,445



Thanked 27 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: code.gif

Thanks.
User is offlineProfile CardPM

Go to the top of the page

kamlesh
post 17 Apr, 2008 - 11:34 PM
Post #9


New D.I.C Head

*
Joined: 8 Apr, 2008
Posts: 12

QUOTE(jayman9 @ 17 Apr, 2008 - 09:15 AM) *

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: code.gif

Thanks.



Thanks Buddy,
Here is the code i m posting , but remember that when i am retriving records from two, three or more tables it is returing all records when we bind to crystal Reports.

//see The code .

Plssssssssssss Help me out. I m new to Crystal Reports.
//*********************************************************//

csharp

SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
DataSet ds;
protected void Page_Load(object sender, EventArgs e)
{
ds = new DataSet();
ds= (DataSet)Session["data"];



//da = new SqlDataAdapter("select* From salesummary", con);
//ds = new DataSet();
//da.Fill(ds);
CrystalDecisions.CrystalReports.Engine.ReportDocument myReportDocument;
myReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

//myReportDocument.Load(@"C:\Documents and Settings\Administrator\Desktop\MaitreeGiftShop _New\CrystalReport.rpt");


// // any of these three methods should work to fill the document
// //
//// myReportDocument.Database.Tables[0].SetDataSource(ds);
myReportDocument.Database.Tables[0].SetDataSource(ds);

// myReportDocument.SetDataSource(ds.Tables[0].ToString());

CrystalReportViewer1.ReportSource = myReportDocument;
// CrystalReportViewer1.Zoom(1);
CrystalReportViewer1.DataBind();



//myReportDocument.Database.Tables["preview"].SetDataSource(myDS);
////myReportDocument.Database.Tables[0].SetDataSource(myDS);
////myReportDocument.SetDataSource(myDS);

//CrystalReportViewer1.ReportSource = myReportDocument;
//CrystalReportViewer1.DataBind();
}


//********************************************************//


Plsssssssss Help me ?
Bye,
Kamlakar.

EDIT: Code tags added

This post has been edited by PsychoCoder: 18 Apr, 2008 - 12:33 AM
User is offlineProfile CardPM

Go to the top of the page

kamlesh
post 21 Apr, 2008 - 09:43 PM
Post #10


New D.I.C Head

*
Joined: 8 Apr, 2008
Posts: 12

QUOTE(kamlesh @ 17 Apr, 2008 - 11:34 PM) *

QUOTE(jayman9 @ 17 Apr, 2008 - 09:15 AM) *

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: code.gif

Thanks.



Thanks Buddy,
Here is the code i m posting , but remember that when i am retriving records from two, three or more tables it is returing all records when we bind to crystal Reports.

//see The code .

Plssssssssssss Help me out. I m new to Crystal Reports.
//*********************************************************//

csharp

SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
DataSet ds;
protected void Page_Load(object sender, EventArgs e)
{
ds = new DataSet();
ds= (DataSet)Session["data"];



//da = new SqlDataAdapter("select* From salesummary", con);
//ds = new DataSet();
//da.Fill(ds);
CrystalDecisions.CrystalReports.Engine.ReportDocument myReportDocument;
myReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

//myReportDocument.Load(@"C:\Documents and Settings\Administrator\Desktop\MaitreeGiftShop _New\CrystalReport.rpt");


// // any of these three methods should work to fill the document
// //
//// myReportDocument.Database.Tables[0].SetDataSource(ds);
myReportDocument.Database.Tables[0].SetDataSource(ds);

// myReportDocument.SetDataSource(ds.Tables[0].ToString());

CrystalReportViewer1.ReportSource = myReportDocument;
// CrystalReportViewer1.Zoom(1);
CrystalReportViewer1.DataBind();



//myReportDocument.Database.Tables["preview"].SetDataSource(myDS);
////myReportDocument.Database.Tables[0].SetDataSource(myDS);
////myReportDocument.SetDataSource(myDS);

//CrystalReportViewer1.ReportSource = myReportDocument;
//CrystalReportViewer1.DataBind();
}


//********************************************************//


Plsssssssss Help me ?
Bye,
Kamlakar.

EDIT: Code tags added





Hi,
Thanks for ur reply.

But paste only that code u have changed i m not getting all.
I need to fetch only those records i have selected with condition not all records from database.

Pls send reply asap.
Thanks,
Kamlakar.

User is offlineProfile CardPM

Go to the top of the page

kamlesh
post 3 May, 2008 - 05:18 AM
Post #11


New D.I.C Head

*
Joined: 8 Apr, 2008
Posts: 12

Hi,

I am developing a asp.net application with C#.
I have one dropdownlist with 10 nos. I have one button when i select 1,2,3 ......etc from dropdownlist and click on button then dynamically one dropdownlist ,ont Textbox and one Button will generate.

My Question is that when i add some Int or String value to text (dynamically created) Then the value should be bind to Dropdownlist on Button click(Dynamically Created).

Can anybody tell me how to do this?

Its very Very Urgent.


I am posting the code here.

private void AddMajor()
{
int MajCount = int.Parse(DropDown_Major.SelectedValue);
for (int i = 0; i < MajCount; i++)
{

DropDownList dl1 = new DropDownList();
dl1.ID = "Appt2" + i.ToString();
dl1.Width = Unit.Pixel(104);
TextBox T1 = new TextBox();
T1.ID = "Majadd" + i.ToString();
T1.Width = Unit.Pixel(100);
Button b1 = new Button();
b1.ID = "btnMaj" + i.ToString();
b1.Width = Unit.Pixel(100);
b1.Text = "MajAdd";

// PopulateCourses(dl1, dl2);
//dl = (DropDownList)PlaceHolder_Courses.FindControl("dl1");
//Response.Write(dl.SelectedItem.Text);
PlaceHolder_Major.Controls.Add(dl1);
PlaceHolder_Major.Controls.Add(new LiteralControl(" "));
PlaceHolder_Major.Controls.Add(T1);
PlaceHolder_Major.Controls.Add(new LiteralControl(" "));

PlaceHolder_Major.Controls.Add(b1);
PlaceHolder_Major.Controls.Add(new LiteralControl(" "));




}
}


Please tell me how to Bind value to Dropdown when i will enter some string in Textbox(Dynamically Created) click on Button (Dynamically Created) .

Pls Tell me Its Very Very Urgent?

Thanks,
Kamlesh

User is offlineProfile CardPM

Go to the top of the page

kamlesh
post 4 May, 2008 - 09:23 PM
Post #12


New D.I.C Head

*
Joined: 8 Apr, 2008
Posts: 12


Hi,

I am developing a asp.net application with C#.
I have one dropdownlist with 10 nos. I have one button when i select 1,2,3 ......etc from dropdownlist and click on button then dynamically one dropdownlist ,ont Textbox and one Button will generate.

My Question is that when i add some Int or String value to text (dynamically created) Then the value should be bind to Dropdownlist on Button click(Dynamically Created).

Can anybody tell me how to do this?

Its very Very Urgent.


I am posting the code here.

private void AddMajor()
{
int MajCount = int.Parse(DropDown_Major.SelectedValue);
for (int i = 0; i < MajCount; i++)
{

DropDownList dl1 = new DropDownList();
dl1.ID = "Appt2" + i.ToString();
dl1.Width = Unit.Pixel(104);
TextBox T1 = new TextBox();
T1.ID = "Majadd" + i.ToString();
T1.Width = Unit.Pixel(100);
Button b1 = new Button();
b1.ID = "btnMaj" + i.ToString();
b1.Width = Unit.Pixel(100);
b1.Text = "MajAdd";

// PopulateCourses(dl1, dl2);
//dl = (DropDownList)PlaceHolder_Courses.FindControl("dl1");
//Response.Write(dl.SelectedItem.Text);
PlaceHolder_Major.Controls.Add(dl1);
PlaceHolder_Major.Controls.Add(new LiteralControl(" "));
PlaceHolder_Major.Controls.Add(T1);
PlaceHolder_Major.Controls.Add(new LiteralControl(" "));

PlaceHolder_Major.Controls.Add(b1);
PlaceHolder_Major.Controls.Add(new LiteralControl(" "));




}
}


Please tell me how to Bind value to Dropdown when i will enter some string in Textbox(Dynamically Created) click on Button (Dynamically Created) .

Pls Tell me Its Very Very Urgent?

Thanks,
Kamlesh
[/quote]
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/7/08 08:42PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month