469,602 Members | 1,727 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

Need some help please on creating Service for PABX Data Dumper Using VB 2005

Hello everyone. I'm creating windows service application to capture
data from my PABX, and send the data to sql server. My question is how
could my application know when that PABX is sending data and not? I get
really confused here. Please check my code and give me some idea or
clue or help please :). Thanks in advance. My code is like this:

Dim DBConnection As SqlConnection
Dim WithEvents SPConnection As SerialPort = New
Dim RawData As String

Private Sub ConnectingDB()

Dim connectionString As String = _
"Integrated Security=SSPI;Persist Security Info=False; " + _
"Initial Catalog=PABX;Data Source=USER/SQL2000"
DBConnection = New SqlConnection(connectionString)


End Sub
Private Sub SPConnection_DataReceived(ByVal sender As Object, _
ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _
Handles SPConnection.DataReceived
RawData = SPConnection.ReadExisting()
End Sub

Private Sub SavetoDB()
Dim sqlTran As SqlTransaction = DBKoneksi.BeginTransaction()
Dim command As SqlCommand = DBKoneksi.CreateCommand()
command.Transaction = sqlTran

command.CommandText = _
"INSERT INTO SampleTable VALUES(RawData)"
Console.WriteLine("Both records were written to database.")
Catch ex As Exception
Console.WriteLine("Neither record was written to
End Try

End Sub

Protected Overrides Sub OnStart(ByVal args() As String)
With SPConnection
.PortName = "COM1"
.BaudRate = 57600
.Parity = Parity.None
.DataBits = 8
.StopBits = StopBits.One
End With
End Sub

Protected Overrides Sub OnStop()
End Sub

Jun 14 '06 #1
0 913

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Cobra Pilot | last post: by
reply views Thread by Eric | last post: by
1 post views Thread by Steven | last post: by
14 posts views Thread by horos | last post: by
reply views Thread by Jeova Almeida | last post: by
reply views Thread by Jeova Almeida | last post: by
reply views Thread by guiromero | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.