C2025-027-AnnotationsTypeSelect #574

Merged
jjenko merged 10 commits from C2025-027-AnnotationsTypeSelect into Development 2025-07-30 08:23:07 -04:00
34 changed files with 2363 additions and 1348 deletions
Showing only changes of commit 6f04d0bf07 - Show all commits

View File

@@ -101,14 +101,17 @@ namespace VEPROMS
// dltFlg flag is used to notify SQL SP to deleted all the entries for the user before entering the annotation type selections. // dltFlg flag is used to notify SQL SP to deleted all the entries for the user before entering the annotation type selections.
int dltFlg = 1; int dltFlg = 1;
foreach (AnnotataionItem item in lstSelected.Items.OfType<AnnotataionItem>()) //foreach (AnnotataionItem item in lstSelected.Items.OfType<AnnotataionItem>())
mschill marked this conversation as resolved Outdated

just to double check --- Is there a reason we are updating the DisplayMember / ValueMember every time we go through the loop?

Wasn't this already set when the form loaded --- line 160ish?

just to double check --- Is there a reason we are updating the DisplayMember / ValueMember every time we go through the loop? Wasn't this already set when the form loaded --- line 160ish?

I moved the variables

I moved the variables
{ //{
AnnotationTypeID = item.TypeID; // AnnotationTypeID = item.TypeID;
AnnotationNameStr = item.NameStr; // AnnotationNameStr = item.NameStr;
DataTable dt2 = coverToTable(UserID);
VEPROMS.CSLA.Library.AnnotationstypeSelections.Update2(dt2);
// dltFlg = 0;
//}
VEPROMS.CSLA.Library.AnnotationstypeSelections.Update(UserID, AnnotationTypeID, dltFlg, AnnotationNameStr);
dltFlg = 0;
}
} }
public class AnnotataionItem public class AnnotataionItem
{ {
@@ -172,6 +175,20 @@ namespace VEPROMS
{ {
this.Close(); this.Close();
} }
private DataTable coverToTable(string userid)
{
DataTable dt = new DataTable();
dt.Columns.Add("TypeID", typeof(Int32));
dt.Columns.Add("NameStr", typeof(string));
dt.Columns.Add("UserID", typeof(string));
foreach (AnnotataionItem item in lstSelected.Items.OfType<AnnotataionItem>())
{
dt.Rows.Add(item.TypeID, item.NameStr, userid);
}
return dt;
}
} }
} }

View File

@@ -1,5 +1,3 @@
Set NoCount On; Set NoCount On;
If (db_name() in('master','model','msdn','tempdb')) If (db_name() in('master','model','msdn','tempdb'))
@@ -24076,16 +24074,72 @@ ELSE
GO GO
-- C2025-027 Annotation Type Filtering
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AnnotationTypeSelections]') AND type in (N'U'))
DROP TABLE [dbo].[AnnotationTypeSelections]
mschill marked this conversation as resolved Outdated

won't this wipe out all thier pre-existing data every time PROMSFixes is run?

won't this wipe out all thier pre-existing data every time PROMSFixes is run?
GO
/****** Object: Table [dbo].[AnnotationTypeSelections] Script Date: 7/10/2025 2:38:23 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Paul Larsen
-- Create date: 07/10/2025
-- Description: Store user Annotation selections for annotation filter.
-- =============================================
CREATE TABLE [dbo].[AnnotationTypeSelections](
[ASTypeID] [int] IDENTITY(1,1) NOT NULL,
[TypeID] [int] NULL,
[UsrID] [varchar](50) NULL,
[Name] [nvarchar](100) NULL,
mschill marked this conversation as resolved Outdated

I could be wrong but I thought some of these were being removed and joins done to the AnnotationType table to get things like Name, IsEpAnnotationType, etc...?

I could be wrong but I thought some of these were being removed and joins done to the AnnotationType table to get things like Name, IsEpAnnotationType, etc...?

This is still valid.

I thought Name was being removed from AnntationsSelections and just going to be pulled from AnnotationsType?

Also, not sure what Config is for here?

This is still valid. I thought Name was being removed from AnntationsSelections and just going to be pulled from AnnotationsType? Also, not sure what Config is for here?
[Config] [nvarchar](max) NULL,
[DTS] [datetime] NULL,
[UserID] [nvarchar](100) NULL,
mschill marked this conversation as resolved
Review

Would suggest not having columns named both UserID and UserID in the same table as it is confusing which is the function of each,
Would suggest renaming UserID as something like CreatedBy.

Would suggest not having columns named both UserID and UserID in the same table as it is confusing which is the function of each, Would suggest renaming UserID as something like CreatedBy.
[LastChanged] [timestamp] NULL,
[IsEPAnnotationType] [bit] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
--CREATE UNIQUE INDEX idx_AnnotationTypeSelections_Usrid
mschill marked this conversation as resolved Outdated

if commented out, should be removed or reason given why commented out?

if commented out, should be removed or reason given why commented out?

Comment removed.

Comment removed.
--ON AnnotationTypeSelections (TypeID, Name, UsrID);
--GO
IF EXISTS (SELECT * FROM sys.indexes WHERE name='idx_AnnotationTypeSelections_UsrID'
AND object_id = OBJECT_ID('[dbo].[AnnotationTypeSelections]'))
begin
DROP INDEX [idx_AnnotationTypeSelections_UsrID] ON [dbo].[AnnotationTypeSelections];
mschill marked this conversation as resolved Outdated

remove:

, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF

This was what we caught was not compatible with SQL 2016

remove: , OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF This was what we caught was not compatible with SQL 2016
end
CREATE NONCLUSTERED INDEX idx_AnnotationTypeSelections_UsrID
mschill marked this conversation as resolved Outdated

Wouldn't you want the index on UsrID,TypeID?

I also thought name was being removed from this table?

see previous notes / wouldn;t this be UNIQUE by UsrID, TypeID

Wouldn't you want the index on UsrID,TypeID? I also thought name was being removed from this table? see previous notes / wouldn;t this be UNIQUE by UsrID, TypeID

Added an index.

Added an index.

Comment still valid:

index should be UNIQUE by
(1) UsrID, TypeID
or
(2) TypeID, UsrID
and INCLUDE other columns pulled back like:
ASTypeID

for whether it should be (1) or (2), I suggest trying each individually and looking at the execution plan to see which is grabbed / better --- if you need assistance with this, please let me know and I can give assistance as I am quite familiar with looking at the execution plans in SQL,

Comment still valid: index should be UNIQUE by (1) UsrID, TypeID or (2) TypeID, UsrID and INCLUDE other columns pulled back like: ASTypeID for whether it should be (1) or (2), I suggest trying each individually and looking at the execution plan to see which is grabbed / better --- if you need assistance with this, please let me know and I can give assistance as I am quite familiar with looking at the execution plans in SQL,

There is another comment around line 24235that is related to this. It just moved since there have been changes since that comment was made. That one should have likely the exact index needed.

There is another comment around line 24235that is related to this. It just moved since there have been changes since that comment was made. That one should have likely the exact index needed.
ON [dbo].[AnnotationTypeSelections] (UsrID)
INCLUDE (TypeID, Name)
GO
--CREATE NONCLUSTERED INDEX [idx_AnnotationTypeSelections_Usrid] ON [dbo].[AnnotationTypeSelections]
mschill marked this conversation as resolved
Review

if commented out, should be removed or reason given why commented out?

if commented out, should be removed or reason given why commented out?
--(
-- [UsrID] ASC
--)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
--GO
--CREATE NONCLUSTERED INDEX [idx_AnnotationTypeSelections_TypeID] ON [dbo].[AnnotationTypeSelections]
mschill marked this conversation as resolved Outdated

So .... unless I have this backwards:
This is for filtering out Annotation Types --- so wouldn't anything selected in AnnotationTypeSelections need / be filtered out.

so basically, by default, we would show all annotation types / if a new annotation type was added it would show & only what is selected would be filtered out .......

if this is the case, wouldn't we want this info to come from AnnotationTypes
& be basically:

Select
AnnotationTypes.[TypeID],
AnnotationTypes.[Name],
AnnotationTypes.[Config],
AnnotationTypes.[DTS],
AnnotationTypes.[UserID],
AnnotationTypes.[LastChanged],
(SELECT COUNT(*) FROM [Annotations] WHERE [Annotations].[TypeID]=[AnnotationTypes].[TypeID]) [AnnotationCount],
AnnotationTypes.[IsEPAnnotationType]
FROM [AnnotationTypes]
LEFT OUTER JOIN AnnotationTypeSelections ON AnnotationTypeSelections.TypeID = AnnotationTypes.TypeID
WHERE AnnotationTypeSelections.UsrID = @UsrID
AND
AnnotationTypeSelections.ASTypeID IS NULL

----again, may be thinking of this wrong ... but was thinking we were storing in the db what they picked to filter out.

So .... unless I have this backwards: This is for filtering out Annotation Types --- so wouldn't anything selected in AnnotationTypeSelections need / be filtered out. so basically, by default, we would show all annotation types / if a new annotation type was added it would show & only what is selected would be filtered out ....... if this is the case, wouldn't we want this info to come from AnnotationTypes & be basically: Select AnnotationTypes.[TypeID], AnnotationTypes.[Name], AnnotationTypes.[Config], AnnotationTypes.[DTS], AnnotationTypes.[UserID], AnnotationTypes.[LastChanged], (SELECT COUNT(*) FROM [Annotations] WHERE [Annotations].[TypeID]=[AnnotationTypes].[TypeID]) [AnnotationCount], AnnotationTypes.[IsEPAnnotationType] FROM [AnnotationTypes] LEFT OUTER JOIN AnnotationTypeSelections ON AnnotationTypeSelections.TypeID = AnnotationTypes.TypeID WHERE AnnotationTypeSelections.UsrID = @UsrID AND AnnotationTypeSelections.ASTypeID IS NULL ----again, may be thinking of this wrong ... but was thinking we were storing in the db what they picked to filter out.

SPs

[getAnnotationstypeSelections] select selected types for right listbox

getAnnotationSelectListTypes select from Annotationtypes table fitering out any selected types for left listbox

getAnnotationstypeFiltered select selected filtered (if any) otherwise show all annotation types. Used in AnnotationDetails drop down.

SPs [getAnnotationstypeSelections] select selected types for right listbox getAnnotationSelectListTypes select from Annotationtypes table fitering out any selected types for left listbox getAnnotationstypeFiltered select selected filtered (if any) otherwise show all annotation types. Used in AnnotationDetails drop down.

see next set of comments - these moved around due to changes since.

see next set of comments - these moved around due to changes since.
--(
mschill marked this conversation as resolved
Review

If commented out, would remove or give reason why commented out?

If commented out, would remove or give reason why commented out?
Review

Comment removed.

Comment removed.
-- [TypeID] ASC
--)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
--GO
-- C2025-027 Annotation Type Filtering -- C2025-027 Annotation Type Filtering
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getAnnotationSelectListTypes]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getAnnotationSelectListTypes]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [getAnnotationSelectListTypes]; DROP PROCEDURE [getAnnotationSelectListTypes];
GO GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ============================================= -- =============================================
-- Author: Paul Larsen -- Author: Paul Larsen
-- Create date: 7/10/2025 -- Create date: 7/10/2025
@@ -24104,13 +24158,10 @@ AS
[DTS], [DTS],
[UserID], [UserID],
[LastChanged], [LastChanged],
(SELECT COUNT(*) FROM [Annotations] WHERE [Annotations].[TypeID]= [TypeID]) [AnnotationCount] (SELECT COUNT(*) FROM [Annotations] WHERE [Annotations].[TypeID]= [TypeID]) [AnnotationCount],
--[IsEPAnnotationType] [IsEPAnnotationType]
FROM [AnnotationTypes] --A FROM [AnnotationTypes] --A
mschill marked this conversation as resolved Outdated

see earlier note - will get better performance if
LEFT OUTER JOIN AnnotationTypeSelections ON AnnotationTypeSelections.TypeID = AnnotationTypes.TypeID

than use a subquery.

see earlier note - will get better performance if LEFT OUTER JOIN AnnotationTypeSelections ON AnnotationTypeSelections.TypeID = AnnotationTypes.TypeID than use a subquery.

Changed query.

Changed query.

still valid - this refers to the query in getAnnotationSelectListTypes
around line:
24148

still valid - this refers to the query in getAnnotationSelectListTypes around line: 24148
--JOIN AnnotationTypeSelections S ON S.TypeID = A.TypeID WHERE TypeID NOT IN (SELECT TypeID FROM AnnotationTypeSelections WHERE UsrID = @UserID)
WHERE TypeID NOT IN (SELECT TypeID FROM AnnotationTypeSelections WHERE UsrID = @UserID) --S.ItemID = @ItemID AND S.TypeID != A.TypeID
RETURN
GO GO
@@ -24154,7 +24205,6 @@ IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getAnnotationsty
GO GO
SET ANSI_NULLS ON SET ANSI_NULLS ON
GO GO
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER ON
GO GO
@@ -24198,12 +24248,42 @@ BEGIN
END END
END END
mschill marked this conversation as resolved Outdated

shouldn't need a primary key on a type?

shouldn't need a primary key on a type?
GO
-- C2025-027 Annotation Type Filtering -- C2025-027 Annotation Type Filtering
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AnnotationTypeSelections]') AND type in (N'U')) --IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[TableValAnnotTypeSelections]') AND OBJECTPROPERTY(id,N'IsType') = 1)
DROP TABLE [dbo].[AnnotationTypeSelections]
-- Type --
--IF NOT EXISTS (SELECT * FROM sys.types WHERE is_table_type = 1 AND name ='TableValAnnotTypeSelections')
-- DROP PROCEDURE [TableValAnnotTypeSelections];
--GO
--/****** Object: UserDefinedTableType [dbo].[TableValAnnotTypeSelections] Script Date: 7/21/2025 8:06:11 PM ******/
--CREATE TYPE [dbo].[TableValAnnotTypeSelections] AS TABLE(
mschill marked this conversation as resolved Outdated

If commented out, would remove or give reason why commented out?

If commented out, would remove or give reason why commented out?

Removed it

Removed it
-- [TypeID] [int] NOT NULL,
-- [NameStr] [varchar](200) NULL,
-- [UserID] [varchar](50) NULL
--)
--GO
-- C2025-027 Annotation Type Filtering
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[UpdateAnnotationstypeSelections2]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [UpdateAnnotationstypeSelections2];
-- Need to drop UpdateAnnotationstypeSelections2 SP first so script can drop and recreate the TableValAnnotTypeSelections table type
mschill marked this conversation as resolved Outdated

only need to delete the ones not already in the table. If we delete and re-add then will lose history of when truely added --- see comment below (around line 24278) for more complete,

only need to delete the ones not already in the table. If we delete and re-add then will lose history of when truely added --- see comment below (around line 24278) for more complete,
IF EXISTS( SELECT * FROM INFORMATION_SCHEMA.DOMAINS WHERE Domain_Name = 'TableValAnnotTypeSelections' )
DROP TYPE [dbo].[TableValAnnotTypeSelections]
CREATE TYPE [dbo].[TableValAnnotTypeSelections] AS TABLE(
mschill marked this conversation as resolved Outdated

So, shouldn't NameStr not be part of the AnnotationTypeSelections and instead pull from AnnotationTypes?

(As could have situation where the Names become out of sink if it is stored multiple places)

So, shouldn't NameStr not be part of the AnnotationTypeSelections and instead pull from AnnotationTypes? (As could have situation where the Names become out of sink if it is stored multiple places)

I left it in the table.

I left it in the table.

would not loop through this is will perform poorly and should not be necessary. It looks like my previous comment got removed with this change as it is now past the end of this file, so I will reply to this shortly with that same comment again.

would not loop through this is will perform poorly and should not be necessary. It looks like my previous comment got removed with this change as it is now past the end of this file, so I will reply to this shortly with that same comment again.

would think would want to do something like:

--this would delete only the ones for this User that are not in the uploaded table
DELETE FROM AnnotationTypeSelections where UsrID in
(Select UsrID From @TempTable tmp)
AND
TypeID not in
(Select TypeID From @TempTable tmp)

--this would insert all the ones that are in the uploaded table and not already in AnnotationTypeSelections
Insert INTO AnnotationTypeSelections (TypeID, UsrID)
Select TypeID, UserID
FROM
@TempTable tmp
LEFT OUTER JOIN
AnnotationTypeSelections ATS on ATS.TypeID = tmp.TypeID
AND ATS.UsrID = tmp.UsrID
where
ATS.ASTypeID IS NULL

would think would want to do something like: --this would delete only the ones for this User that are not in the uploaded table DELETE FROM AnnotationTypeSelections where UsrID in (Select UsrID From @TempTable tmp) AND TypeID not in (Select TypeID From @TempTable tmp) --this would insert all the ones that are in the uploaded table and not already in AnnotationTypeSelections Insert INTO AnnotationTypeSelections (TypeID, UsrID) Select TypeID, UserID FROM @TempTable tmp LEFT OUTER JOIN AnnotationTypeSelections ATS on ATS.TypeID = tmp.TypeID AND ATS.UsrID = tmp.UsrID where ATS.ASTypeID IS NULL

Also as a heads up - I sent an email with an attachment --- looks like there is a side consequence to having Userid be part of the table type and not separate --- that side consequence occurs if you have items selected and then want to de-select all of the items.

Also as a heads up - I sent an email with an attachment --- looks like there is a side consequence to having Userid be part of the table type and not separate --- that side consequence occurs if you have items selected and then want to de-select all of the items.
[TypeID] [int] NOT NULL,
[NameStr] [varchar](200) NULL,
[UserID] [varchar](50) NULL
)
GO GO
/****** Object: Table [dbo].[AnnotationTypeSelections] Script Date: 7/10/2025 2:38:23 PM ******/
/****** Object: StoredProcedure [dbo].[UpdateAnnotationstypeSelections2] Script Date: 7/21/2025 8:51:42 PM ******/
SET ANSI_NULLS ON SET ANSI_NULLS ON
GO GO
@@ -24212,33 +24292,51 @@ GO
-- ============================================= -- =============================================
-- Author: Paul Larsen -- Author: Paul Larsen
-- Create date: 07/10/2025 -- Create date: 07/21/2025
-- Description: Store user Annotation selections for annotation filter. -- Description: Manage user choice annotation types
-- ============================================= -- =============================================
CREATE PROC [dbo].[UpdateAnnotationstypeSelections2]
CREATE TABLE [dbo].[AnnotationTypeSelections](
[ASTypeID] [int] IDENTITY(1,1) NOT NULL,
[TypeID] [int] NULL,
[UsrID] [varchar](50) NULL,
[Name] [nvarchar](100) NOT NULL,
[Config] [nvarchar](max) NULL,
[DTS] [datetime] NOT NULL,
[UserID] [nvarchar](100) NOT NULL,
[LastChanged] [timestamp] NOT NULL,
[IsEPAnnotationType] [bit] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [idx_AnnotationTypeSelections_Usrid] ON [dbo].[AnnotationTypeSelections]
( (
[UsrID] ASC @TempTable AS dbo.TableValAnnotTypeSelections READONLY
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] )
GO AS
CREATE NONCLUSTERED INDEX [idx_AnnotationTypeSelections_TypeID] ON [dbo].[AnnotationTypeSelections] BEGIN
(
[TypeID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
--INSERT INTO CUSTOMER (CustomerId,CustomerName ,Isdeleted )
mschill marked this conversation as resolved Outdated

If commented out, would remove or give reason why commented out?

If commented out, would remove or give reason why commented out?

Removed it

Removed it
--SELECT CustomerId, CustomerName, 0 AS Isdeleted FROM @TempTable
MERGE AnnotationTypeSelections AS TARGET
USING @TempTable AS SOURCE
/* 1. Performing the UPDATE operation */
/* If the P_ID is same,
check for change in P_NAME or P_PRICE */
ON (TARGET.TypeID = SOURCE.TypeID)
WHEN MATCHED
AND TARGET.Name <> SOURCE.NameStr
/* Update the records in TARGET */
THEN UPDATE
SET TARGET.Name = SOURCE.NameStr,
TARGET.UsrID = SOURCE.UserID
/* 2. Performing the INSERT operation */
/* When no records are matched with TARGET table
Then insert the records in the target table */
WHEN NOT MATCHED BY TARGET
THEN INSERT (TypeID, Name, UsrID)
VALUES (SOURCE.TypeID, SOURCE.NameStr,SOURCE.UserID)
/* 3. Performing the DELETE operation */
/* When no records are matched with SOURCE table
Then delete the records from the target table */
WHEN NOT MATCHED BY SOURCE
mschill marked this conversation as resolved Outdated

Wouldn't this delete ones by other users?

would think would want to do something like:

DELETE FROM AnnotationTypeSelections where UsrID in
(Select UsrID From @TempTable tmp)
AND
TypeID not in
(Select TypeID From @TempTable tmp)

Insert INTO AnnotationTypeSelections (TypeID, UsrID)
Select TypeID, UserID
FROM
@TempTable tmp
LEFT OUTER JOIN
AnnotationTypeSelections on AnnotationTypeSelections.TypeID = tmp.TypeID
AND AnnotationTypeSelections.UsrID = tmp.UsrID
where
ASTypeID IS NULL

Wouldn't this delete ones by other users? would think would want to do something like: DELETE FROM AnnotationTypeSelections where UsrID in (Select UsrID From @TempTable tmp) AND TypeID not in (Select TypeID From @TempTable tmp) Insert INTO AnnotationTypeSelections (TypeID, UsrID) Select TypeID, UserID FROM @TempTable tmp LEFT OUTER JOIN AnnotationTypeSelections on AnnotationTypeSelections.TypeID = tmp.TypeID AND AnnotationTypeSelections.UsrID = tmp.UsrID where ASTypeID IS NULL

Made changes to the insert statement in the SP.

Made changes to the insert statement in the SP.
THEN DELETE;
END
GO
IF (@@Error = 0) PRINT 'Running vesp_UpdateEPFormat Succeeded' IF (@@Error = 0) PRINT 'Running vesp_UpdateEPFormat Succeeded'
ELSE PRINT 'Running vesp_UpdateEPFormat Failed to Execute' ELSE PRINT 'Running vesp_UpdateEPFormat Failed to Execute'

View File

@@ -166,6 +166,31 @@ namespace VEPROMS.CSLA.Library
catch (Exception ex) catch (Exception ex)
{ {
}
}
}
}
public static void Update2(DataTable dt)
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
try
mschill marked this conversation as resolved Outdated

if have a try catch, should there be something in the catch?

if have a try catch, should there be something in the catch?
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "UpdateAnnotationstypeSelections2";
cm.CommandTimeout = Database.DefaultTimeout;
//Pass table Valued parameter to Store Procedure
SqlParameter sqlParam = cm.Parameters.AddWithValue("@TempTable", dt);
sqlParam.SqlDbType = SqlDbType.Structured;
cm.ExecuteNonQuery();
}
catch (Exception ex)
{
} }
} }
} }