MS SQL Server :: Null Reference Exception

Hi.
I  am running into a null reference exception on replication with SQL Server 2005. The problem occurs at synchronize process.
Exception shows as "an unexpected error has occurred in AppName.exe. Select Quit and then restart this program, or select Details for more information.
I think the problem is in SQL Server, because after restarting SQL service synchronization works for an hour and after the problem start again. I've tried to increase remote query time from 600 to 6000 but doesn't  help  either
Here is detail of my pocket PC (in case if you need them)
Device O/S: Windows Mobile 5.0 v 5.1.195 Build 14957.2.3.1
Hardware: Dell Axim X51v, Intel PXA270

Any ideas on this?

Artak.
artakamiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan McCauleyData and Analytics ManagerCommented:
It's impossible to tell from what you've posted here. A NullRefernceException occurs when you declare a variable, but then try to use it before it's been assigned a value (or after the value has been cleared).

Can you post the code where the exception occurs (you should be able to see where it's being caused in the Stack Trace in your event)? If possible, all the code between the line the causes the exception (at the end) and the variable's declaration (at the beginning) would be a good starting place for seeing what's causing this exception.
0
hjgodeCommented:
You wrote about using SQL Server replication, I assume with SQL Sercer CE compact. Are you using RDA (PULL, PUSH, SqlCommand) or Merge replication?

How is the device powered?

Is it connected via a cabled (Ethernet) or wireless Lan or via ActiveSync to the SQL Server?

You may enable Logging or just take a look for the log files at the virtual directory of the SQL servers publication. Take a look in the SQL CE Agent logs, the SQL Server and the Server logs.
0
artakamiAuthor Commented:
here is the details of error from pocket PC.

EzRoute.exe
WebException

   at System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke(String methodName, Object[] parameters, WebClientAsyncResult asyncResult)
   at EzRoute.lerch.EzRouteService.GetChangedProducts(Int32 lastRun, String lastSalesperson)
   at EzRoute.Synchronize.btProceed_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.ButtonBase.WnProc(WM wm, Int32 wParam, Int32 lParam)
   at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)
   at Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)
   at System.Windows.Forms.Application.Run(Form fm)
   at EzRoute.MSR.Main()

Thats what i could get from it.
also, if needed , i can provide log or any data from MS SQL server.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

hjgodeCommented:
Thta does not look like SQL to me. This looks like a webservice request that fails. The route cause may be a faulty SQL query, but that is not in focus here.
0
artakamiAuthor Commented:
The part of EzRoute.exe's role is to synchronize it's data with MS SQL server every morning (I have MS SQLCE installed on pocket PC as EzRoute.exe requires it). I assume that problem is related with SQL because its newer happens before, when database was about 20-25GB in size. Now size of database is 40 GB and I have no other problem related with size. Another thing that makes me think thats it can be solved by doing something with SQL is that after restarting MS SQL server EzRoute.exe synchronizing with no problem about 0.5-1 hour and then problem appears again.

restarting SQL server could be a solution but I have about 50 pockets with EzRoute.exe  running on them and they are not syncing all in same time.
0
hjgodeCommented:
Sounds like you have to look at the servers SQL and SQL CE Agent (SQL Compact) logs. Possibly you have to change the log level of SQL Compact agent.

Possibly the server runs out of memory. Possibly youre question should be moved to the sql server area of experts-exchange.

The code you showed does not show any SQL client or merge command. How do you sync the data? Does it sync 20GB to the device???
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
artakamiAuthor Commented:
No I don't sync 20GB, when size goes up server becomes slower. This happened before and what i have done, I moved database to another server and started clean database on the main server. but I cant do it now because we are in middle of financial year, and using two  separate databases will be disaster.

About SQL CE log and server memory I can tell you tomorrow morning (the company is in GMT+4 +DST)
0
artakamiAuthor Commented:
Here is another report of same error. It comes from WM6.5 (previous one from WM6.1)

EzRoute.exe
NullReferenceException
 
at EzRoute.Synchronize.UpdateProducts()
at EzRoute.Synchronize.btProceed_Click()
at System.Windows.Forms.Control.OnClick()
at System.Windows.Forms.Button.OnClick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at EzRoute.MSR.Main()
0
artakamiAuthor Commented:

hjgode:
Sounds like you have to look at the servers SQL and SQL CE Agent (SQL Compact) logs. Possibly you have to change the log level of SQL Compact agent.
It might sound amateurish, but how to enable SQL CE Agent (SQL Compact) logs on Windows Mobile?

Possibly the server runs out of memory.
Server has 8GB physical memory installed on it. and normally loaded only 5.32-5.50GB sqlserver.exe using 1.5-1.7GB. While Syncing memory usage by sqlserver.exe does not change but processor usage goes up to 7%.
MS SQL Server memory Options setted up:
Minimum Server Memory: 2048MB
Maximum Server Memory: 5120MB
"Use AWE to allocate memory" unchecked.
Can anything be wrong here?
0
hjgodeCommented:
SQL CE agent runs on the server, but as you dont know of it, the EzRoute.Sync command does not use it. SQL server CE agent is used for RDA and Merge Replication.

Look at the SQL server logs.
0
artakamiAuthor Commented:
I have enabled "AWE to allocate memory", and it seems to be working.
The memory usage now is:
   server's memory usage went up to 7,5GB
   but sqlserver.exe is now using only  110MB
I'll leave it to run a couple of days for testing

hjgode: thanks for the clue.
0
artakamiAuthor Commented:
No errors after two days testing.

sorted!

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Smartphone Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.