I have a VB Service but database not field with data

I have a  VB Service that every 20000 it will input datas in the database but after 20000 milliseconds it would not input anything on the sql database
so I don't know what to do

but when I would create this code with a windows application VB and click process it would input the data from dbf to sql but when it's running on a service it would not I will attach the code here so please help me thanks a lot :D
sourcecode.txt
kennethzxcAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Olaf DoschkeSoftware DeveloperCommented:
I can't help you with the code.

One detail, you query: DATETIME() - 10000, that means - 10000 seconds, not milliseconds.

So that should rather be DATETIME() - 10 for the last 10 seconds.

Problems of access rights can be because of running your Service as a System account, which is not having read access to LAN shares, for example.

Bye, Olaf.
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
It means that the service is running under a different user which does not have access or could not find the database. It would be best to write the error to a file log to know what is going on.

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
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
Visual Basic.NET

From novice to tech pro — start learning today.