TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kavi suja
NA
298
171.2k
Write DAL file using StoredProcedure
Jun 8 2013 3:57 AM
Hi,
I have stored Procedure for retriving counts of old or new patients.My stored Procedure works correctly.Now I've to write DAL file,BAL file using this stored procedure.But i'm in stage just i fully confused now.can you help me guys?I have to use MySqlDataReader for return counts of patients.
CREATE DEFINER=`root`@`%` PROCEDURE `GetPatientsCount`(IN PDID INT, IN PDATE DATE , IN UTYPE VARCHAR(20))
BEGIN
IF PDID > 0
THEN
SELECT
if(DATE_FORMAT(P.firstVisitDate, '%Y-%m-%d') = PDATE,
'New Patient',
'Old Patient')
AS UserType,
count(
if(
DATE_FORMAT(P.firstVisitDate, '%Y-%m-%d') = PDATE,
'New Patient',
'Old Patient')) as Cnt
FROM commonpersoninfo AS C,
appointment_has_doctor AS AD,
appointment AS A,
symptoms AS S,
personinfo P
WHERE A.pkey = AD.Appointment_pkey
AND C.PKEY = A.PatientInfo_PKey
AND AD.DoctorsInfo_pkey = PDID
AND S.CommonPersonInfo_pkey = C.pkey
AND DATE_FORMAT(a.STARTDATETIME, '%Y-%m-%d') = PDATE
AND P.CommonPersonInfo_pkey = C.pkey
AND if(
DATE_FORMAT(P.firstVisitDate, '%Y-%m-%d') = PDATE,
'New Patient',
'Old Patient') = UTYPE
GROUP BY UserType;
ELSE
SELECT if(DATE_FORMAT(P.firstVisitDate, '%Y-%m-%d') = PDATE,
'New Patient',
'Old Patient')
AS UserType,
count(
if(
DATE_FORMAT(P.firstVisitDate, '%Y-%m-%d') = PDATE,
'New Patient',
'Old Patient')) as Cnt
FROM commonpersoninfo AS C,
appointment_has_doctor AS AD,
appointment AS A,
symptoms AS S,
personinfo P
WHERE A.pkey = AD.Appointment_pkey
AND C.PKEY = A.PatientInfo_PKey
AND S.CommonPersonInfo_pkey = C.pkey
AND DATE_FORMAT(a.STARTDATETIME, '%Y-%m-%d') = PDATE
AND P.CommonPersonInfo_pkey = C.pkey
AND if(
DATE_FORMAT(P.firstVisitDate, '%Y-%m-%d') = PDATE,
'New Patient',
'Old Patient') = UTYPE
GROUP BY UserType;
END IF;
END
Reply
Answers (
1
)
how to scan document through c# code.
Assign value to server side variable using javascript