My SQL Server 2012 contains a function Get_Schedule
:
CREATE FUNCTION Get_Schedule(
@pProject_Id AS INT,
@pPeriod_Start AS DATETIME2,
@pPeriod_End AS DATETIME2)
RETURNS TABLE
WITH SCHEMABINDING
AS
RETURN (
SELECT
42 AS Val1,
'Foo' AS Val2);
Visual Studio 2015's SQL Server Object Explorer shows the function parameters with the types as defined.
However when dragging the function to the strongly typed dataset designer the DATETIME2
parameters are changed to ANSISTRING
instead of System.DateTime
or System.Data.SqlDbType.DateTime2
.
The int
parameter, @pProject_Id
does have the correct type.
This happens both when using a select statement for the table adapter to access the database and when creating new a stored procedure (the procedure itself does have the expected DATATIME2
as parameter but the generated table adapter has ansistring
).
How to have the correct parameter types in the generated table adapters?
After adding the query and its table adapter:
SelectCommand
; and,Parameters
tot the correct type.