Hello,
I am having a problem that I can't solve and would appreciate any help you can offer.
I have a table in my SQL DB that contains :
- ID
- Date From
- Date To
I then have a SQL function that pulls out the Start Date (See code below)
NB: The reason for converting the date to a char(10) was because initially I was calling this function from a stored procedure and required the date to be passed in a certain format.Code:CREATE FUNCTION dbo.fn_YearBreakdownDateFrom (@Date datetime) RETURNS char(10) AS BEGIN DECLARE @RetVal datetime DECLARE @ConvertedDate char(10) SET @RetVal = (SELECT DateFrom FROM dbo.tbl_YearBreakdown WHERE (DateFrom <= CONVERT(DATETIME, @Date, 103)) AND (DateTo >= CONVERT(DATETIME, @Date, 103))) SET @ConvertedDate = CONVERT(Char(10), @RetVal, 103) RETURN @ConvertedDate END
In my VB.NET app I need to call this function and get the Start Date to populate a text box on my form.
However, I don't know how to do this as in the past I've always just called stored procedures which have in turn returned the data from the functions.
Can anyone help me please ?
Thanks in advance




Reply With Quote