M
Mark B
My gridview update command seems to always execute the first part of the SQL
statement regardless of whether or not there is a value for the
@AutoNumberID parameter. Any ideas?
UpdateCommand="
IF @AutoNumberID IS NULL
INSERT INTO dbo.tblLanguageValues(LanguageCode, LookupID,
LanguageText)
VALUES (@LanguageCode, @LookupID, @LanguageText)
ELSE
UPDATE dbo.tblLanguageValues
SET LanguageText = @LanguageText
WHERE LanguageCode = @LanguageCode AND LookupID = @LookupID"
based on the SELECT stored procedure for the Gridview:
ALTER PROCEDURE [dbo].[uspGeneralLanguageMaintenanceValuesGet]
@LanguageCode varchar(20)
AS
IF @LanguageCode = 'EN-US'
SELECT
AutoNumberID, LanguageCode,
LookupID, LanguageText, LanguageText as English, ToDo
FROM
dbo.tblLanguageValues
WHERE
LanguageCode = 'EN-US'
ELSE
SELECT
LV.AutoNumberID, @LanguageCode AS LanguageCode,
US.LookupID, LV.LanguageText, US.LanguageText as English,
LV.ToDo
FROM
dbo.tblLanguageValues US
LEFT OUTER JOIN dbo.tblLanguageValues LV
ON US.LookupID = LV.LookupID AND
LV.LanguageCode = @LanguageCode
WHERE
US.LanguageCode = 'EN-US'
statement regardless of whether or not there is a value for the
@AutoNumberID parameter. Any ideas?
UpdateCommand="
IF @AutoNumberID IS NULL
INSERT INTO dbo.tblLanguageValues(LanguageCode, LookupID,
LanguageText)
VALUES (@LanguageCode, @LookupID, @LanguageText)
ELSE
UPDATE dbo.tblLanguageValues
SET LanguageText = @LanguageText
WHERE LanguageCode = @LanguageCode AND LookupID = @LookupID"
based on the SELECT stored procedure for the Gridview:
ALTER PROCEDURE [dbo].[uspGeneralLanguageMaintenanceValuesGet]
@LanguageCode varchar(20)
AS
IF @LanguageCode = 'EN-US'
SELECT
AutoNumberID, LanguageCode,
LookupID, LanguageText, LanguageText as English, ToDo
FROM
dbo.tblLanguageValues
WHERE
LanguageCode = 'EN-US'
ELSE
SELECT
LV.AutoNumberID, @LanguageCode AS LanguageCode,
US.LookupID, LV.LanguageText, US.LanguageText as English,
LV.ToDo
FROM
dbo.tblLanguageValues US
LEFT OUTER JOIN dbo.tblLanguageValues LV
ON US.LookupID = LV.LookupID AND
LV.LanguageCode = @LanguageCode
WHERE
US.LanguageCode = 'EN-US'