Click here to Skip to main content
15,908,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can you please help me to create a report by writing stored Procedure means upto a particular date
this is my code below but in database expert what i have to do..

C#
ReportDocument cryRpt = new ReportDocument();
Connection obj = new Connection();
obj.getconn();
SqlCommand cmd3 = new SqlCommand();
cmd3.Connection = obj.con;
cmd3.CommandText = "SELQuotationbtdates";
cmd3.CommandType = CommandType.StoredProcedure;
DateTime dte = new DateTime();
dte = Convert.ToDateTime(dateTimePicker1.Text);
string formatted1 = dte.ToString("dd-MM-yyyy");
cmd3.Parameters.AddWithValue("@todate", formatted1);
SqlDataAdapter ds3 = new SqlDataAdapter(cmd3);
ds3.Fill(dst); 
cryRpt.Load("C:/Users/User/Desktop/test1/WindowsFormsApplication1/CrystalReport1.rpt");
cryRpt.SetDataSource(dst);
crystalReportViewer1.ReportSource = cryRpt;
Posted
Updated 15-Apr-13 21:22pm
v2
Comments
Malli_S 16-Apr-13 3:39am    
If possible, please indent and restructure the code.

1 solution

Your question is not clear, so i can only suggest you to follow the below links:
Create procedure[^]
Using stored procedures in a command[^]

Example procedure:
SQL
CREATE PROCEDURE SELQuotationbtdates
    @toDate DATETIME
AS
BEGIN
    SELECT *
    FROM Table1
    WHERE DateField <=@toDate
END
 
Share this answer
 
Comments
Sharon 2 16-Apr-13 4:11am    
actully my doubt is what i have to take from field explorer after writing code
Sharon 2 16-Apr-13 4:13am    
means from databaseexpert whether i have to take table and place it in the design part of report

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900