I am building a website for our fishing club and developing a module for allow users to register their fish. I need help with a stored procedure that will return the fish a individual angler registered that day. Here is what I have so far:
create procedure YourCompanys_GetRegisteredFishToday
@ModuleId int
as
select ModuleId,
ItemId,
Species,
FishLength,
Points,
CreatedByUser,
YourCompanys_FishScores.CreatedDate,
'CreatedByUserName' = Users.FirstName + ' ' + Users.LastName
from YourCompanys_FishScores
inner join Users on YourCompanys_FishScores.CreatedByUser = User.UserId
where ModuleId = @ModuleId
and YourCompanys_FishScores.CreatedDate >= DATEADD(day,DATEDIFF(day,0,GETDATE()),0) AND
YourCompanys_FishScores.CreatedDate < DATEADD(day,DATEDIFF(day,0,GETDATE()),1)
GO
The problem is I keep getting this error:
System.Data.SqlClient.SqlException: Cannot call methods on nvarchar. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at DotNetNuke.Data.SqlDataProvider.ExecuteADOScript(String SQL) at DotNetNuke.Data.SqlDataProvider.ExecuteScript(String Script, Boolean UseTransactions) create procedure YourCompanys_GetRegisteredFishToday @ModuleId int as select ModuleId, ItemId, Species, FishLength, Points, CreatedByUser, YourCompanys_FishScores.CreatedDate, 'CreatedByUserName' = Users.FirstName + ' ' + Users.LastName from YourCompanys_FishScores inner join Users on YourCompanys_FishScores.CreatedByUser = User.UserId where ModuleId = @ModuleId and YourCompanys_FishScores.CreatedDate >= DATEADD(day,DATEDIFF(day,0,GETDATE()),0) AND YourCompanys_FishScores.CreatedDate < DATEADD(day,DATEDIFF(day,0,GETDATE()),1)