Home > Software engineering >  C# application works fine on server but throws null exception error on client machine
C# application works fine on server but throws null exception error on client machine

Time:11-30

Here's the code for line 186.Line 297 on the error refers to THROW on the below code. On the server, there is no error on the above lines. The problem comes when I tried to run the app from client machines. How can it work on Server and failed on client machine with a null exception error? Any idea on this? Thank you.

public void saveVote()
{
string val = "";
val = "'"   m_sessid   "','"  
m_nomineeshid   "','"  
m_votershid   "','"  
m_nomineeid   "','"  
m_nominee   "','"  
m_nomineeamh   "','"  
m_voteregcode   "','"  
m_votershno   "','"  
m_votershamt   "','"  
m_crtby   "','"  
m_crtdt   "','"  
m_isnombynoninf   "','"  
m_nomineeregcode   "','"  
m_isvoterinf   "','"  
m_isnomforbod   "','"  
m_votercode   "'";
try
{
dac.Insert("tblVotForBoDNominees", val);
}
catch (Exception q)
{
throw new Exception(q.Message   " "   
q.InnerException.Message.ToString());
}
}
Line 297 on the error refres to THROW on the above code

CodePudding user response:

At this line in Vote.cs file might be a call of external resource like environment variable. In such case it's possible, as it requires to set it up on every machine. Provide the code, please. There can be different reasons and it's difficult to guess blinded.

CodePudding user response:

check the lines number from log error in "Vote.cs" file, you are using something that only exists in your server but not in clients.

  •  Tags:  
  • c#
  • Related