Problem in building a windows service

  • Thread starter Thread starter suzzimmi
  • Start date Start date
S

suzzimmi

Hello,
My problem is as follows:

I have built a windows service to run a vb program in a specified time
(says, run in every four hours or so).
The windows service program itself works fine.
The vb program consists of two VB classes in two separated .vb files in
which Class A is a logic codes while Class B is accomodated with stored
procedures and other DB stuff.
When executing a line of code calling the Class B vb files (which is
consisted of calls to use stored procedure link with the SQL Server), the VB
program jumps out itself back to the windows service. It seems like the VB
program skipping execution when dealing with stored procedure.
===================
In Class B,
Dim strConn as String = "Database=abc; server=135; uid=sa; pwd=0000;"
"
"
" (Inside a sub of Class B)
SqlHelper.ExecuteNonQuery(strConn, "sp_DoSomething", _var1)
"
===================
I also tried to use like this:
SqlHelper.ExecuteNonQuery("Database=abc; server=135; uid=sa; pwd=0000;",
"sp_DoSomething", _var1)
to test if that works but still failed (the VB program stops executing the
rest of the codes and jumps back to the window service).

Does anyone know why? and solution?

Thousands thanks!
 
Few more additional words,
1. the vb file of Class B is using sqlhelper to manipulate DB transactions
by importing applicationblock.data.dll.
2. I am not sure whether the helper works with the windows service.
3. How it's failed is that :

a/ Portion of codes in the Class B .vb file
Public Sub TestService( )
Dim dummyLine As String = "This is a dummy line to test if the sub is being
reached in here."
' try to connect with SQL Server thr SqlHelper; assumming value of _var1 is
written into the DB table after executing a stored procedure called
"sp_DoSomething"
SqlHelper.ExecuteNonQuery("Database=abc; server=135; uid=sa; pwd=0000;",
"sp_DoSomething", _var1)
End Sub

b/ in Class A .vb file, the object of Class B is created by NEW with the
name of CurrentObj and which calls to execute TestService like this:
CurrentObj.TestService( )

c/ However, this line of code is not executed and the flow of running in
Class A is stopped as well. The flow jumps back to the windows service and
then it sits still to wait for next time interval to execute the codes again.

100% appreciation and 1000+ > thanks to you!

-suzzimmi
 
Are you using Try/Catch logic? Have you tried using the debugger when
running the service as a test locally? Is the problem local, or after
deployment?

Jeff
 
Back
Top