3 列項目の複数行を取得するストアド プロシージャがあります。DataTable の形式で取得しています。デバッグするとエラーが発生します
スカラー変数 @Ticket を宣言する必要があります。
しかし、私はすでにそれを宣言しました。
ストアド プロシージャ:
BEGIN
Declare @Ticket Numeric(28,0)
Declare @SQL VarChar(Max)
Declare @SQLUpdate VarChar(Max)
Set @SQL='Select @Ticket=Ticket,VendorTicket[Vendor Ticket],Comments From dbo.VendorTickets Where NotifyOn <= GetDate() And IsNull(NotifyOn,0)<>0 '
Exec(@SQL)
Set @SQLUpdate='Update dbo.VendorTicket Set NotifyOn=0 Where Ticket=@Ticket'
Exec(@SQLUpdate)
END
ストアド プロシージャを呼び出すコード
SqlConnection oConn = null;
DataTable dtReturn = null;
try
{
getConnection(ref oConn, 1);
using (SqlStoredProcedure sspObj = new SqlStoredProcedure("dbo.usp_checkNotification", oConn, CommandType.StoredProcedure))
{
dtReturn = sspObj.ExecuteDataTable();
sspObj.Dispose();
}
closeConnection(ref oConn);
}