.Net Services (transfering Data from AS400 into SQL Server)




I have BIG question and I gues it is the BEST question.

I have a problem that I am guessing the best solution is to create some sort
..NET Services.

This Service(s) must check every hour the data that reside on AS400 and
transfer into the SQL Server. Services also have to be run in between 8:00 AM
and 5:00 PM

Does anyone knows how to achive this. I like to have some small example to
learn but if everyone is bussy than I guess I am more than happy to receive
any answere that will show me the right direction.

I thank you in advance to you for reading this post.


W.G. Ryan - MVP

Create two data adapters, one for the IBM and one for the Sql Server. Set
the AcceptChangesDuringFill property of the IBM adapter to false. Fill the
datatable. Then, immediately use the same datatable and call update using
the Sql Server adapter.

Obviously ADO.NET isn't the ideal technology for data transfer, but if you
must do it client side, this should work for you


Hi Ryan,

Thank you for input. I use similar method to achive while transfering data
between IBM AS400 to SQL Server with user interaction method.

In my main form under File menu I have option so user can manually transfer
a data just clicking simple menu button.

But my problem is I want to do this via Windows Services and I have no idea
how to achive it.

I don't like to use a Timer that I can imort from Toolbox. I want to use
System.Timer so I can calculate the tick method like (1 * 60 * 60 * 100)
so Windows Services can run the transfer every 1 hours between 8:00AM and

Hers is the my code and my questions that I find the only way to achive it?

Imports System
Imports System.ServiceProcess
Imports System.Diagnostics
Imports System.Timers

Public Class TransferData: inherits ServiceBase
proteced timer As Timer

Public Shared Sub Main()
ServiceBase.Run(New TransferData)
End Sub

Public Sub New()
CanPauseAndContinue = True
ServiceName = "CHQ_TransferData"

timer = new Timer()
timer.Interval = 3600000 'Every 1 Hour (1 * 60 * 60 * 1000)
AddHandler timer.Elapsed, AddressOf onTimer
End Sub

Protected Overrides Sub OnStart(args() As String)
EventLog.WriteEntry("CHQ_TransferData Service Started")
timer.Enabled = True
End Sub

Protected Overrides Sub OnStop()
EventLog.WriteEntry("CHQ_TransferData Service Stoped")
timer.Enabled = False
End Sub

Protected Overrides Sub OnPause()
EventLog.WriteEntry("CHQ_TransferData Service Paused")
timer.Enabled = False
End Sub

Protected Overrides Sub OnContinue()
EventLog.WriteEntry("CHQ_TransferData Service Continued")
timer.Enabled = True
End Sub

Protected Sub OnTimer()
'I belive I HAVE to call the another class that does the Transfering
Dim callTransfer as New clsTransferData
End Sub

End Class


I belive inside the Protected Sub OnTimer() I will have to call another
class that does the transfering Job. Am I right?

- Can you or anyone tell me if I am right? And If not what should I do?
- If I am right How can I use the error information in case of any failure
and inform the Administrator
that services is failed? So they can check it or simply Transfer the data
- If everythings might be okay for you than how to achive the Installation
process without using InstallUtil.exe manulay? How can I create a simple
setup for this services so Admin people simpley runs the setup and install
the Services on the PC that SQL Server resides on?

Again I thank you in advance for your kind understanding and your future help.


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question