Technology is VB.Net and Sql Server. I have a stored procedure
CREATE OR ALTER PROC [dbo].[sp_bring_some_data]
(
@My_Data as myTableValuedType READONLY,
@My_Context as bit
)
AS
BEGIN
IF @My_Context = 0
BEGIN
-- this sp accepts a table-valued params
EXEC sp_bring_some_data_0 @My_Inner_Data = @My_Data
END
ELSE
BEGIN
-- this sp is parameterless
EXEC sp_bring_some_data_b
END
END
This sp is a SelectCommand for a TableAdapter. Of course the autogenerated fill method has three params:
Public Overloads Overridable Function Fill(ByVal dataTable As ds.sp_fill_some_dataDataTable, ByVal My_Data As Object, ByVal My_Context As Global.System.Nullable(Of Boolean)) As Integer
In some context of my application I do not have a proper DataTable object for @My_Data param. I would like to be able to run my sp with @My_Context = 1 in which I do not need the data table for my calcuiations.
It appears I cannot pass Nothing into my Fill function, as table-valuded params do not accept nulls.
As I have read here, I can pass default
as a param on sql side to pass a proper empty table.
My problem is how to force TableAdapter's Fill method to pass default do the sql server.
My workaround is to prepare a proper dummy DataTable to pass when there is no real one, but I hope there is some nicer approach.
Thanks in advance!