Application crash after SQLDependancy





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















In my ViewModel, I'm calling NotifyMe() which does the following:



  SqlDependency.Start(ConfigurationManager.ConnectionStrings["StringConnexion"].ConnectionString);
await _connection.OpenAsync();

using (command = new SqlCommand(
"SELECT [NUM_DRC] ,[MAT_EMP] ,[NUM_RC] ,[DEBUT_DRC] ,[FIN_DRC],[DATE_ETAB_DRC] ,[MOTIF_DRC] ,[STATUS_DRC] FROM [dbo].[DEMANDE_RECUPERATION] WHERE [STATUS_DRC] = 'En attente' ",
_connection))
{
dependency = new SqlDependency(command);
dependency.OnChange += OnDependencyChange;
using (reader = await command.ExecuteReaderAsync())
{
while (reader.Read())
{
RcCount++;

}

}
}

using (command2 = new SqlCommand("SELECT[NUM_DC] ,[MAT_EMP] ,[NUM_CONGE] ,[DATE_ETAB_DC] ,[DC_DEBUT] ,[DC_FIN] ,[LIEU_JOUISSANCE] ,[STATUS_DC] FROM[dbo].[DEMANDE_CONGE] WHERE [STATUS_DC] = 'En attente'",
_connection))
{
dependency2 = new SqlDependency(command2);
dependency2.OnChange += OnDependencyChange2;
using (reader2 = await command2.ExecuteReaderAsync())
{
while (reader2.Read())
{
DcCount++;

}

}

}


using (command3 = new SqlCommand("SELECT[NUM_DAS],[MAT_EMP],[NUM_AS],[DATE_ETAB_DAS],[DEBUT_DAS],[FIN_DAS],[MOTIF_DAS],[STATUS_DAS] FROM[dbo].[DEMANDE_DE_SORTIE] WHERE [STATUS_DAS] = 'En attente' ",
_connection))
{
dependency3 = new SqlDependency(command3);
dependency3.OnChange += OnDependencyChange3;
using (reader3 = await command3.ExecuteReaderAsync())
{
while (reader3.Read())
{
AsCount++;

}

}

}


using (command4 = new SqlCommand("SELECT [NUM_DAB] ,[NUM_ABS],[MAT_EMP],[DATE_ETAB_DAB],[DEBUT_DAB],[FIN_DAB],[MOTIF_DAB],[STATUS_DAB] FROM [dbo].[DEMANDE_ABSENCE] WHERE [STATUS_DAB] = 'En attente' ",
_connection))
{
dependency4 = new SqlDependency(command4);
dependency4.OnChange += OnDependencyChange4;
using (reader4 = await command4.ExecuteReaderAsync())
{
while (reader4.Read())
{
AbsCount++;

}

}

}





using (command5 = new SqlCommand("SELECT [NUM_DMD],[NUM_MD],[MAT_EMP],[DATE_ETAB_DMD],[DEBUT_DMD],[FIN_DMD],[MOTIF_DMD],[STATUS_DMD] FROM [dbo].[DEMANDE_MD] WHERE [STATUS_DMD] = 'En attente' ",
_connection))
{
dependency5 = new SqlDependency(command5);
dependency5.OnChange += OnDependencyChange5;
using (reader5 = await command5.ExecuteReaderAsync())
{
while (reader5.Read())
{
MdCount++;

}

}

}


In my computer, everything is running fine.



I tried to run the same application in my friend's laptop, and the application is opening for 1 second then close with no error messages or anything. If I remove the NotifyMe(), It works fine.



Where would the issue be in this case? I can't do debugging on that PC since I don't have Visual studio, how do you suggest me to go in that case?










share|improve this question























  • Do other functions work, that access the database? Maybe your friends computer is not allowed to access your database?!

    – schlonzo
    Nov 16 '18 at 14:06











  • @schlonzo All functions work yes, except for this one. For some reason, It's making the app crash.

    – Zkai
    Nov 16 '18 at 14:10











  • Subscribe to catchall exception handler (AppDomain.UnhandledException), see what is the error throwing by your app.

    – RajN
    Nov 16 '18 at 15:07


















0















In my ViewModel, I'm calling NotifyMe() which does the following:



  SqlDependency.Start(ConfigurationManager.ConnectionStrings["StringConnexion"].ConnectionString);
await _connection.OpenAsync();

using (command = new SqlCommand(
"SELECT [NUM_DRC] ,[MAT_EMP] ,[NUM_RC] ,[DEBUT_DRC] ,[FIN_DRC],[DATE_ETAB_DRC] ,[MOTIF_DRC] ,[STATUS_DRC] FROM [dbo].[DEMANDE_RECUPERATION] WHERE [STATUS_DRC] = 'En attente' ",
_connection))
{
dependency = new SqlDependency(command);
dependency.OnChange += OnDependencyChange;
using (reader = await command.ExecuteReaderAsync())
{
while (reader.Read())
{
RcCount++;

}

}
}

using (command2 = new SqlCommand("SELECT[NUM_DC] ,[MAT_EMP] ,[NUM_CONGE] ,[DATE_ETAB_DC] ,[DC_DEBUT] ,[DC_FIN] ,[LIEU_JOUISSANCE] ,[STATUS_DC] FROM[dbo].[DEMANDE_CONGE] WHERE [STATUS_DC] = 'En attente'",
_connection))
{
dependency2 = new SqlDependency(command2);
dependency2.OnChange += OnDependencyChange2;
using (reader2 = await command2.ExecuteReaderAsync())
{
while (reader2.Read())
{
DcCount++;

}

}

}


using (command3 = new SqlCommand("SELECT[NUM_DAS],[MAT_EMP],[NUM_AS],[DATE_ETAB_DAS],[DEBUT_DAS],[FIN_DAS],[MOTIF_DAS],[STATUS_DAS] FROM[dbo].[DEMANDE_DE_SORTIE] WHERE [STATUS_DAS] = 'En attente' ",
_connection))
{
dependency3 = new SqlDependency(command3);
dependency3.OnChange += OnDependencyChange3;
using (reader3 = await command3.ExecuteReaderAsync())
{
while (reader3.Read())
{
AsCount++;

}

}

}


using (command4 = new SqlCommand("SELECT [NUM_DAB] ,[NUM_ABS],[MAT_EMP],[DATE_ETAB_DAB],[DEBUT_DAB],[FIN_DAB],[MOTIF_DAB],[STATUS_DAB] FROM [dbo].[DEMANDE_ABSENCE] WHERE [STATUS_DAB] = 'En attente' ",
_connection))
{
dependency4 = new SqlDependency(command4);
dependency4.OnChange += OnDependencyChange4;
using (reader4 = await command4.ExecuteReaderAsync())
{
while (reader4.Read())
{
AbsCount++;

}

}

}





using (command5 = new SqlCommand("SELECT [NUM_DMD],[NUM_MD],[MAT_EMP],[DATE_ETAB_DMD],[DEBUT_DMD],[FIN_DMD],[MOTIF_DMD],[STATUS_DMD] FROM [dbo].[DEMANDE_MD] WHERE [STATUS_DMD] = 'En attente' ",
_connection))
{
dependency5 = new SqlDependency(command5);
dependency5.OnChange += OnDependencyChange5;
using (reader5 = await command5.ExecuteReaderAsync())
{
while (reader5.Read())
{
MdCount++;

}

}

}


In my computer, everything is running fine.



I tried to run the same application in my friend's laptop, and the application is opening for 1 second then close with no error messages or anything. If I remove the NotifyMe(), It works fine.



Where would the issue be in this case? I can't do debugging on that PC since I don't have Visual studio, how do you suggest me to go in that case?










share|improve this question























  • Do other functions work, that access the database? Maybe your friends computer is not allowed to access your database?!

    – schlonzo
    Nov 16 '18 at 14:06











  • @schlonzo All functions work yes, except for this one. For some reason, It's making the app crash.

    – Zkai
    Nov 16 '18 at 14:10











  • Subscribe to catchall exception handler (AppDomain.UnhandledException), see what is the error throwing by your app.

    – RajN
    Nov 16 '18 at 15:07














0












0








0








In my ViewModel, I'm calling NotifyMe() which does the following:



  SqlDependency.Start(ConfigurationManager.ConnectionStrings["StringConnexion"].ConnectionString);
await _connection.OpenAsync();

using (command = new SqlCommand(
"SELECT [NUM_DRC] ,[MAT_EMP] ,[NUM_RC] ,[DEBUT_DRC] ,[FIN_DRC],[DATE_ETAB_DRC] ,[MOTIF_DRC] ,[STATUS_DRC] FROM [dbo].[DEMANDE_RECUPERATION] WHERE [STATUS_DRC] = 'En attente' ",
_connection))
{
dependency = new SqlDependency(command);
dependency.OnChange += OnDependencyChange;
using (reader = await command.ExecuteReaderAsync())
{
while (reader.Read())
{
RcCount++;

}

}
}

using (command2 = new SqlCommand("SELECT[NUM_DC] ,[MAT_EMP] ,[NUM_CONGE] ,[DATE_ETAB_DC] ,[DC_DEBUT] ,[DC_FIN] ,[LIEU_JOUISSANCE] ,[STATUS_DC] FROM[dbo].[DEMANDE_CONGE] WHERE [STATUS_DC] = 'En attente'",
_connection))
{
dependency2 = new SqlDependency(command2);
dependency2.OnChange += OnDependencyChange2;
using (reader2 = await command2.ExecuteReaderAsync())
{
while (reader2.Read())
{
DcCount++;

}

}

}


using (command3 = new SqlCommand("SELECT[NUM_DAS],[MAT_EMP],[NUM_AS],[DATE_ETAB_DAS],[DEBUT_DAS],[FIN_DAS],[MOTIF_DAS],[STATUS_DAS] FROM[dbo].[DEMANDE_DE_SORTIE] WHERE [STATUS_DAS] = 'En attente' ",
_connection))
{
dependency3 = new SqlDependency(command3);
dependency3.OnChange += OnDependencyChange3;
using (reader3 = await command3.ExecuteReaderAsync())
{
while (reader3.Read())
{
AsCount++;

}

}

}


using (command4 = new SqlCommand("SELECT [NUM_DAB] ,[NUM_ABS],[MAT_EMP],[DATE_ETAB_DAB],[DEBUT_DAB],[FIN_DAB],[MOTIF_DAB],[STATUS_DAB] FROM [dbo].[DEMANDE_ABSENCE] WHERE [STATUS_DAB] = 'En attente' ",
_connection))
{
dependency4 = new SqlDependency(command4);
dependency4.OnChange += OnDependencyChange4;
using (reader4 = await command4.ExecuteReaderAsync())
{
while (reader4.Read())
{
AbsCount++;

}

}

}





using (command5 = new SqlCommand("SELECT [NUM_DMD],[NUM_MD],[MAT_EMP],[DATE_ETAB_DMD],[DEBUT_DMD],[FIN_DMD],[MOTIF_DMD],[STATUS_DMD] FROM [dbo].[DEMANDE_MD] WHERE [STATUS_DMD] = 'En attente' ",
_connection))
{
dependency5 = new SqlDependency(command5);
dependency5.OnChange += OnDependencyChange5;
using (reader5 = await command5.ExecuteReaderAsync())
{
while (reader5.Read())
{
MdCount++;

}

}

}


In my computer, everything is running fine.



I tried to run the same application in my friend's laptop, and the application is opening for 1 second then close with no error messages or anything. If I remove the NotifyMe(), It works fine.



Where would the issue be in this case? I can't do debugging on that PC since I don't have Visual studio, how do you suggest me to go in that case?










share|improve this question














In my ViewModel, I'm calling NotifyMe() which does the following:



  SqlDependency.Start(ConfigurationManager.ConnectionStrings["StringConnexion"].ConnectionString);
await _connection.OpenAsync();

using (command = new SqlCommand(
"SELECT [NUM_DRC] ,[MAT_EMP] ,[NUM_RC] ,[DEBUT_DRC] ,[FIN_DRC],[DATE_ETAB_DRC] ,[MOTIF_DRC] ,[STATUS_DRC] FROM [dbo].[DEMANDE_RECUPERATION] WHERE [STATUS_DRC] = 'En attente' ",
_connection))
{
dependency = new SqlDependency(command);
dependency.OnChange += OnDependencyChange;
using (reader = await command.ExecuteReaderAsync())
{
while (reader.Read())
{
RcCount++;

}

}
}

using (command2 = new SqlCommand("SELECT[NUM_DC] ,[MAT_EMP] ,[NUM_CONGE] ,[DATE_ETAB_DC] ,[DC_DEBUT] ,[DC_FIN] ,[LIEU_JOUISSANCE] ,[STATUS_DC] FROM[dbo].[DEMANDE_CONGE] WHERE [STATUS_DC] = 'En attente'",
_connection))
{
dependency2 = new SqlDependency(command2);
dependency2.OnChange += OnDependencyChange2;
using (reader2 = await command2.ExecuteReaderAsync())
{
while (reader2.Read())
{
DcCount++;

}

}

}


using (command3 = new SqlCommand("SELECT[NUM_DAS],[MAT_EMP],[NUM_AS],[DATE_ETAB_DAS],[DEBUT_DAS],[FIN_DAS],[MOTIF_DAS],[STATUS_DAS] FROM[dbo].[DEMANDE_DE_SORTIE] WHERE [STATUS_DAS] = 'En attente' ",
_connection))
{
dependency3 = new SqlDependency(command3);
dependency3.OnChange += OnDependencyChange3;
using (reader3 = await command3.ExecuteReaderAsync())
{
while (reader3.Read())
{
AsCount++;

}

}

}


using (command4 = new SqlCommand("SELECT [NUM_DAB] ,[NUM_ABS],[MAT_EMP],[DATE_ETAB_DAB],[DEBUT_DAB],[FIN_DAB],[MOTIF_DAB],[STATUS_DAB] FROM [dbo].[DEMANDE_ABSENCE] WHERE [STATUS_DAB] = 'En attente' ",
_connection))
{
dependency4 = new SqlDependency(command4);
dependency4.OnChange += OnDependencyChange4;
using (reader4 = await command4.ExecuteReaderAsync())
{
while (reader4.Read())
{
AbsCount++;

}

}

}





using (command5 = new SqlCommand("SELECT [NUM_DMD],[NUM_MD],[MAT_EMP],[DATE_ETAB_DMD],[DEBUT_DMD],[FIN_DMD],[MOTIF_DMD],[STATUS_DMD] FROM [dbo].[DEMANDE_MD] WHERE [STATUS_DMD] = 'En attente' ",
_connection))
{
dependency5 = new SqlDependency(command5);
dependency5.OnChange += OnDependencyChange5;
using (reader5 = await command5.ExecuteReaderAsync())
{
while (reader5.Read())
{
MdCount++;

}

}

}


In my computer, everything is running fine.



I tried to run the same application in my friend's laptop, and the application is opening for 1 second then close with no error messages or anything. If I remove the NotifyMe(), It works fine.



Where would the issue be in this case? I can't do debugging on that PC since I don't have Visual studio, how do you suggest me to go in that case?







c# wpf






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 13:57









ZkaiZkai

716




716













  • Do other functions work, that access the database? Maybe your friends computer is not allowed to access your database?!

    – schlonzo
    Nov 16 '18 at 14:06











  • @schlonzo All functions work yes, except for this one. For some reason, It's making the app crash.

    – Zkai
    Nov 16 '18 at 14:10











  • Subscribe to catchall exception handler (AppDomain.UnhandledException), see what is the error throwing by your app.

    – RajN
    Nov 16 '18 at 15:07



















  • Do other functions work, that access the database? Maybe your friends computer is not allowed to access your database?!

    – schlonzo
    Nov 16 '18 at 14:06











  • @schlonzo All functions work yes, except for this one. For some reason, It's making the app crash.

    – Zkai
    Nov 16 '18 at 14:10











  • Subscribe to catchall exception handler (AppDomain.UnhandledException), see what is the error throwing by your app.

    – RajN
    Nov 16 '18 at 15:07

















Do other functions work, that access the database? Maybe your friends computer is not allowed to access your database?!

– schlonzo
Nov 16 '18 at 14:06





Do other functions work, that access the database? Maybe your friends computer is not allowed to access your database?!

– schlonzo
Nov 16 '18 at 14:06













@schlonzo All functions work yes, except for this one. For some reason, It's making the app crash.

– Zkai
Nov 16 '18 at 14:10





@schlonzo All functions work yes, except for this one. For some reason, It's making the app crash.

– Zkai
Nov 16 '18 at 14:10













Subscribe to catchall exception handler (AppDomain.UnhandledException), see what is the error throwing by your app.

– RajN
Nov 16 '18 at 15:07





Subscribe to catchall exception handler (AppDomain.UnhandledException), see what is the error throwing by your app.

– RajN
Nov 16 '18 at 15:07












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339288%2fapplication-crash-after-sqldependancy%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339288%2fapplication-crash-after-sqldependancy%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python