Bonjour dans une solution WPF au démarrage de l'appli j'exécute le code suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using Repository;
using System;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using Utilities.Library;
 
namespace EmailSender
{
    /// <summary>
    /// Logique d'interaction pour App.xaml
    /// </summary>
    public partial class App : Application
    {
        private async void Application_Startup(object sender, StartupEventArgs e)
        {
            try
            {
                await CreateRootFolder();
                await CreateDocumentsBase();
                await CheckTasks();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private async Task CreateRootFolder()
        {
            if (!Directory.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                    $"{Assembly.GetExecutingAssembly().GetName().Name}_Docs")))
            {
                _ = Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                                           $"{Assembly.GetExecutingAssembly().GetName().Name}_Docs"));
            }
            await Task.CompletedTask;
        }
        private async Task CreateDocumentsBase()
        {
            using (EMAILEntities dc = new EMAILEntities())
            {
                _ = dc.ApplicationParamsChecker();
            }
            await Task.CompletedTask;
        }
        private async Task CheckTasks()
        {
            switch (GlobalQueries.TasksAreUnCompleted())
            {
                case true:
                    StartupUri = new Uri("Views/TasksView.xaml", UriKind.Relative);
                    break;
                default:
                    StartupUri = new Uri("MainWindow.xaml", UriKind.Relative);
                    break;
            }
            await Task.CompletedTask;
        }
    }
}
Ce qui pose problème c'est la procédure stockée "ApplicationParamsChecker()" qui renvoi ce message :

Nom : Capture d'écran 2023-12-09 074233.png
Affichages : 101
Taille : 4,9 Ko

Et voici la prcédure stockée en question :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
ALTER PROCEDURE [dbo].[ApplicationParamsChecker] 
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
declare 
@bascisDocsExisits bit,
@DocsHaveBeenInsertedInDocType bit,
@tableClientIsNotEmpty bit,
@tableContactsIsNotEmpty bit;
 
set @bascisDocsExisits = (select T_VERIFIED from TASKS where T_ID = 1);
set @DocsHaveBeenInsertedInDocType = (select T_VERIFIED from TASKS where T_ID = 2);
set @tableClientIsNotEmpty = (select T_VERIFIED from TASKS where T_ID = 4);
set @tableContactsIsNotEmpty = (select T_VERIFIED from TASKS where T_ID = 6);
 
begin transaction;
 
begin try
 
MERGE GENERIC_DOC_NAME AS t  
USING (
	SELECT * FROM GENERIC_DOC_NAME_BASE 
) AS s ON t.UNIQUE_IDENTIFIER = s.GUID 
WHEN MATCHED THEN  
	UPDATE SET
		t.GDN_SHORT_NAME = s.GDN_SHORT_NAME, 
		t.GDN_LIB = s.GDN_LIB,
		t.L_ID = s.L_ID
WHEN NOT MATCHED THEN  
	INSERT (  
		GDN_SHORT_NAME,  
		GDN_LIB,
		L_ID,
		UNIQUE_IDENTIFIER
	)  
	VALUES (
		s.GDN_SHORT_NAME,  
		s.GDN_LIB,  
		s.L_ID,
		s.GUID
	);
update TASKS set T_VERIFIED = 1 where T_ID in (1, 2);
 
declare @nbClientsRows int;
set @nbClientsRows = (select count(CLI_CODE) from CLIENTS);
if @nbClientsRows > 0
	begin
	update TASKS set T_VERIFIED = 1 where T_ID = 4;
	end
 
declare @nbContactsRows int;
set @nbContactsRows = (select count(C_ID) from CONTACTS_CLIENT);
if @nbContactsRows > 0
	begin
	update TASKS set T_VERIFIED = 1 where T_ID = 6;
	end
end try
 
begin catch
if @@TRANCOUNT > 0
rollback transaction;
end catch
if @@TRANCOUNT > 0
commit transaction;
END
j'avoue ne jamais avoir eu ce type de message jusqu'à aujourd'hui...