Monday, August 26, 2013

Click Once en-us en-US download problem (.net)

beim publizieren einer click once app trat folgender fehler auf:
when publishing a click once app, I got this eror:

ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of C:\Users\hewmic\Desktop\Footscanner12.appref-ms| resulted in exception. Following failure messages were detected:
+ Downloading http://www.shaolinqigong.at/zBootdoc/Application Files/BootDoc_WPF_1_2_2013_0821/en-us/BootDoc_WPF.resources.dll.deploy did not succeed.
+ The remote server returned an error: (404) Not Found.

der directory name am web server war großgeschrieben: en-US, geändert auf Kleinschreibung en-us brachte denselben fehler nur dass en-US nicht gefunden werden konnte - scheinbar wird sowohl klein als auch großgeschrieben benötigt.
Workaround: zwei Directories en-us und en-US mit demselben Inhalt angelegt

the directory name on the webserver was uppercase: en-US. So I changed to lowercase, but got the same error, saying the uppercase dir is missing.
Workaround: two dirs with same content en-us and en-US


Tuesday, August 06, 2013

Tableadapter.Fill Constraint Exception: delete and create new - am einfachsten löschen und neu anlegen



to find out which row and which field causes the exception, enable editing in debug mode and press F10, so the debugger goes to the next command, and then display the dataset in a winform datagridview => the causes of exception have a red exclamation mark.
if a Tableadapter.Fill Contraint Exception occurs once and you try to fill again (by using the Debugger) and there is no exception on the second try, then its most likely a primary key problem of the dataset. Its strange, that the  second fill doen't create an exception too.
if nothing works, delete and create new one

um herauszufinden, welche Zeile und welches feld die Exception verursacht, ist es nützlich, das dataset in einem datagridview anzuzeigen - rote rufzeichen markieren die fehlerursache. einfach mit dem debugger nach der exception im Fill Command weitersteppen und das dataset in einem windows form datagridview anzeigen.
wenn beim Aufruf einer Tableadapter Fill Operation eine Contraint Exception auftritt, und man mittels des Debuggers nochmal füllt, und es funktioniert, dann handelt es sich höchstwahrscheinlich um eine Primary Key Verletzung des Datasets.
Wenn das alles nichts hilft, löschen und neu anlegen

Thursday, August 01, 2013

Sql Server Update, Insert Trigger Example / Beispiel



CREATE TRIGGER [dbo].[myTrigger]
   ON  [dbo].[myTable]
   AFTER INSERT,UPDATE
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

    -- Insert statements for trigger here
IF ((SELECT [val_bool] FROM sf_Configuration WHERE name=''debug'') =  1)
BEGIN
DECLARE @Id UniqueiDENTIFIER, @DEBUG_DESCRIPTION VARCHAR(256), @TLD_VALUE int
DECLARE curInserted CURSOR LOCAL
FOR SELECT Id, debug_description, tld_value FROM Inserted
OPEN curInserted
FETCH NEXT FROM curInserted INTO @Id, @DEBUG_DESCRIPTION, @TLD_VALUE
WHILE (@@FETCH_STATUS=0)
BEGIN
   PRINT ''updating debug info''
            UPDATE [sf_GroupSecurity] SET DEBUG_DESCRIPTION=(
select text from sf_TranslationData
where sf_TranslationData.id=@TLD_VALUE and language_id=
(SELECT [val_string] FROM sf_Configuration WHERE name=''debug_lang''))
WHERE [id]=@Id
            FETCH NEXT FROM curInserted INTO @Id, @DEBUG_DESCRIPTION, @TLD_VALUE
END
END
END