Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# SQL-Server
I saw this link,
csharp.net-informations.com
but I need it fully developed using query.my table and query is
create table sample(roomno nvarchar(20),ondate datetime,offdate datetime)
 
insert into sample values(301,'01/26/2013 10:41:08','02/26/2013 10:41:08')
insert into sample values(302,'03/26/2013 15:41:08','02/26/2013 20:41:08')
insert into sample values(301,'02/26/2013 10:41:08','06/26/2013 10:41:08')
insert into sample values(303,'01/26/2013 10:41:08','01/26/2013 13:41:08')
insert into sample values(304,'06/26/2013 10:41:08','08/26/2013 10:41:08')
insert into sample values(305,'09/26/2013 10:41:08','11/26/2013 10:41:08')
 
create procedure smpl AS
BEGIN
select * from sample
end
I need to know how I send the datetime picker and id no as parameter...
Posted 4-Feb-13 2:35am
Edited 4-Feb-13 8:24am
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

better to rewrite the stored procedure like below:
CREATE PROCEDURE smpl
	@roomno VARCHAR(20),
	@ondate DATETIME,
	@offdate DATETIME
AS
BEGIN
	SELECT roomno,
	       roomno,
	       offdate
	FROM   [sample] s
	WHERE  s.roomno = @roomno
	       AND s.ondate = @ondate
	       AND s.offdate = @offdate
END
 
Use this stored procedure as the data source of crystal report and follow the link below to pass parameter from C#.
Crystal Report Filtering Using Selection Parameters[^]
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 446
1 OriginalGriff 380
2 Yogesh Kumar Tyagi 304
3 Prakriti Goyal 200
4 Maciej Los 165
0 OriginalGriff 6,472
1 Sergey Alexandrovich Kryukov 5,404
2 Maciej Los 3,434
3 Peter Leow 3,259
4 DamithSL 2,495


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100