bianchef
asked on
Could not find stored procedure 'GetDatesForMonth' is an error I receive on the aspx page
Could not find stored procedure 'GetDatesForMonth' is an error I receive on the aspx page. The page loads ok with a calendar and an iframe info box but i receive this error from my <asp:Label ID="lblMsg" Runat="server" CssClass="Alert"></asp:Lab el> code. The procedure is created in the database. Any ideas?
my ms sql server code to create the stored procedure is
CREATE PROC dbo.GetAllDateDetail (
@StartDate datetime
)
AS
DECLARE @beginTime datetime
DECLARE @endTime datetime
SET @begintime = Convert(datetime,convert(c har(2),Dat epart(m,@s tartDate)) + '/' +
convert(char(2),Datepart(d ,@startDat e)) + '/' +
convert(char(4),Datepart(y y,@startDa te)))
SET @endtime = Convert(datetime,DATEADD(m s,-10,DATE ADD(d,1,@b egintime)) )
SELECT
ItinID,
DatePart(d,StartDate) as ShowDay,
StartDate,
StartTime,
Venue,
City,
State,
Country
FROM Itin Where
StartDate BETWEEN @beginTime AND @endTime
GO
CREATE PROC dbo.GetDateDetail (
@ItinID int
)
AS
SELECT
ItinID,
DatePart(d,StartDate) as ShowDay,
StartDate,
StartTime,
Venue,
City,
State,
Country
FROM Itin Where ItinID = @ItinID
GO
CREATE PROC dbo.GetDatesForMonth(
@startDate datetime
)
AS
DECLARE @endDate datetime
SET @endDate = Dateadd(s,-1,Dateadd(m,1,@ startDate) )
SELECT
ItinID,
DatePart(d,StartDate) as ShowDay,
StartDate,
StartTime,
Venue
FROM Itin Where StartDate BETWEEN @startDate AND @endDate
my code behind is
Private Function DatesForMonth(ByVal Month As DateTime) As DataTable
Dim cn As SqlConnection = New SqlConnection(cnString)
Dim cmd As SqlDataAdapter = New SqlDataAdapter("GetDatesFo rMonth", cn)
cmd.SelectCommand.CommandT ype = CommandType.StoredProcedur e
Dim dt As New DataTable
Try
AppendSQLParameter(cmd.Sel ectCommand , "@startDate", SqlDbType.DateTime, ParameterDirection.Input, 8, Month)
cmd.Fill(dt)
cmd.Dispose()
cn.Close()
Catch x As SqlException
lblMsg.Text = x.Message
Finally
cn = Nothing
End Try
Return dt
End Function
my ms sql server code to create the stored procedure is
CREATE PROC dbo.GetAllDateDetail (
@StartDate datetime
)
AS
DECLARE @beginTime datetime
DECLARE @endTime datetime
SET @begintime = Convert(datetime,convert(c
convert(char(2),Datepart(d
convert(char(4),Datepart(y
SET @endtime = Convert(datetime,DATEADD(m
SELECT
ItinID,
DatePart(d,StartDate) as ShowDay,
StartDate,
StartTime,
Venue,
City,
State,
Country
FROM Itin Where
StartDate BETWEEN @beginTime AND @endTime
GO
CREATE PROC dbo.GetDateDetail (
@ItinID int
)
AS
SELECT
ItinID,
DatePart(d,StartDate) as ShowDay,
StartDate,
StartTime,
Venue,
City,
State,
Country
FROM Itin Where ItinID = @ItinID
GO
CREATE PROC dbo.GetDatesForMonth(
@startDate datetime
)
AS
DECLARE @endDate datetime
SET @endDate = Dateadd(s,-1,Dateadd(m,1,@
SELECT
ItinID,
DatePart(d,StartDate) as ShowDay,
StartDate,
StartTime,
Venue
FROM Itin Where StartDate BETWEEN @startDate AND @endDate
my code behind is
Private Function DatesForMonth(ByVal Month As DateTime) As DataTable
Dim cn As SqlConnection = New SqlConnection(cnString)
Dim cmd As SqlDataAdapter = New SqlDataAdapter("GetDatesFo
cmd.SelectCommand.CommandT
Dim dt As New DataTable
Try
AppendSQLParameter(cmd.Sel
cmd.Fill(dt)
cmd.Dispose()
cn.Close()
Catch x As SqlException
lblMsg.Text = x.Message
Finally
cn = Nothing
End Try
Return dt
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
125 points to deanvanrooyen for being first to answer and suggesting the starting steps
calling the procedure from the query analyser was how i found that i needed to create user credentials and permissions for the procedure
125 points to nauman_ahmed
connecting to the right database was the answer to add the connections to the <appSettings> my web.config
Thanks to both.