RE: execute SP on the dataSet
From: Suresh (anonymous_at_discussions.microsoft.com)
Date: 03/24/04
- Next message: Neil: "RE: Debugging aspnet_wp.exe"
- Previous message: Suresh: "RE: Extended Search Dropdown?"
- In reply to: simon: "execute SP on the dataSet"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 24 Mar 2004 09:26:06 -0800
>So is it possible to execute stored procedure on my DataSet?
No. But you can select certain records from a DataTable specifying some filter using the DataTable.Select(.....) method.
You can't do joins in the dataset either.
Click on the link for more details and sample.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatatableclassselecttopic.asp
HTH,
Suresh.
----- simon wrote: -----
Hi,
I have for example 3 tables in my database which is on SQL server.
Than I have Stored procedure, which returns the data from that tables
depends on the input date.
Every time when user in my application change the data from calendar, this
procedure on sql server is called
and returns one table and the dataSet (in fact dataTable) is recreated from
the database and dataGrid is rebind to that table in dataSet.
Because my tables in database are updated only once a day I thought:
What If I copy 3 tables from the database into the dataSet and
than when user change the date, execute this procedure on the dataSet
(which is on web server) instead of on the database in my sql server which
is on
the other machine.So is it possible to execute stored procedure on my
DataSet?
Or is there some better solution?
The sintax of SP is very complicated, I'll put here just for information:
CREATE PROCEDURE c_returnTimeSlots
@mediaId as integer,
@datumStart as datetime
AS
DECLARE @week_start DATETIME
SET @week_start =
DATEADD(D,FLOOR(DATEDIFF(D,'19000101',@datumStart)/7)*7,'19000101')
declare @presezenCas int
set @presezenCas=(SELECT cast(set_value as int) FROM cpoSettings WHERE
set_id=1 AND set_medID=@mediaId)
--advFree pogledam, èe je ¹e kaj prostora za reklamo in sicer, èe obstaja
reklama, ki je posegla v prese¾en èas
select T1.*,advFree=case when exists(SELECT * FROM cpoTimeAdv WHERE
ts_id=T1.ts_id AND adv_end>=(dateadd(ss,@presezenCas,T1.endDateHour)))
then 0 else 1 end
FROM
(select t.ts_id,datepart(HH,t.ts_startDate)as
startHour,datepart(HH,t.ts_endDate)as endHour,
datepart(mi,t.ts_endDate)as endMinute,datepart(ss,t.ts_endDate)as endSecond,
LEFT(DATENAME(DW,t.ts_startDate),3) as
startDay,LEFT(DATENAME(DW,t.ts_endDate),3) as endDay,
CONVERT(VARCHAR,t.ts_startDate,108) as
TimeStart,CONVERT(VARCHAR,t.ts_endDate,108) as
TimeEnd,a.adv_id,a.cnt_id,a.adv_name,
datepart(HH,ta.adv_Start)as startAdv,datepart(HH,ta.adv_End)as
endAdv,t.ts_startDate as startDateHour,t.ts_endDate as endDateHour,
CONVERT(VARCHAR,t.ts_startDate,112) as startDate,ta.adv_Start as
advStart,ta.adv_End as advEnd
from cpoTimeSlot t left outer JOIN cpoTimeAdv ta ON t.ts_ID=ta.ts_id
LEFT JOIN cpoAdvertisments a ON ta.adv_id=a.adv_id
WHERE ts_medId=@mediaId AND
(ts_startDate BETWEEN @week_start AND DATEADD(D,7,@week_start)
OR ts_endDate BETWEEN @week_start AND DATEADD(D,7,@week_start))
) as T1
ORDER BY T1.startDateHour,T1.advStart
GO
Thank you for your answer,
Simon
- Next message: Neil: "RE: Debugging aspnet_wp.exe"
- Previous message: Suresh: "RE: Extended Search Dropdown?"
- In reply to: simon: "execute SP on the dataSet"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|