473,566 Members | 3,245 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
System.IO.Ports .SerialPort
Dim RawData As String

Private Sub ConnectingDB()

Dim connectionStrin g As String = _
"Integrated Security=SSPI;P ersist Security Info=False; " + _
"Initial Catalog=PABX;Da ta Source=USER/SQL2000"
DBConnection = New SqlConnection(c onnectionString )

DBConnection.Op en()

End Sub
Private Sub SPConnection_Da taReceived(ByVa l sender As Object, _
ByVal e As System.IO.Ports .SerialDataRece ivedEventArgs) _
Handles SPConnection.Da taReceived
RawData = SPConnection.Re adExisting()
SavetoDB()
End Sub

Private Sub SavetoDB()
Dim sqlTran As SqlTransaction = DBKoneksi.Begin Transaction()
Dim command As SqlCommand = DBKoneksi.Creat eCommand()
command.Transac tion = sqlTran

Try
command.Command Text = _
"INSERT INTO SampleTable VALUES(RawData) "
command.Execute NonQuery()
sqlTran.Commit( )
Console.WriteLi ne("Both records were written to database.")
Catch ex As Exception
Console.WriteLi ne(ex.Message)
Console.WriteLi ne("Neither record was written to
database.")
sqlTran.Rollbac k()
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
SPConnection.Op en()
ConnectingDB()
End Sub

Protected Overrides Sub OnStop()
SPConnection.Cl ose()
DBConnection.Cl ose()
End Sub

Jun 14 '06 #1
0 1084

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2093
by: Cobra Pilot | last post by:
I can't figure out why these three snippits of code are not equivalent.. Can someone show me the correct way to do this... (Cut and paste sample code follows). @tbl is array of array refs: This works like I want it to: foreach (@tbl) { my $key = shift @$_; $hash{$key} = ;
0
5290
by: Eric | last post by:
I've got a weird problem, regardless of how often I enter: perl -MCPAN -e 'install "Data::Dumper"' I never get a message telling me that it is up-to-date. It will always try to reinstall even though the installation is apparently successful. Here is the output: CPAN: Storable loaded ok
1
1455
by: Steven | last post by:
Hi all My problem is a little lengthy. But please help me. In my application, ADO.NET DataSet object is not getting constructed in the Web Service Web Method called by the Windows Application passing an ADO.NET DataSet Object as a parameter to the Web Method in Web Service Debugging using the Soap Extensions, clearly shows that the...
14
3290
by: horos | last post by:
hey all, I'm a heavy perl user, not so much a java script user, and was wondering... perl has an extremely nice utility called Data::Dumper, which allows you to dump out the contents of an arbitrary data structure. I'd like to do the same with javascript. print Data::Dumper(document)
12
5307
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded the custom employee class and have built it as a separate library (employee.dll). This employee.dll is being referenced by both the web service and...
3
4695
by: kevin | last post by:
Is that even possible? I am creating a web service in .NET to expose some already created .NET programs to other groups. One group is writing the client in PERL, and thus wishes the wsdl schema to not be sequenced. (PERL hashes do not retain order information) First, the w3 specs don't mention the sequence in any detail - its just there...
16
2513
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client uses IE to talk with a server. The user on the client (IE) sees an ASP net page containing a TextBox. He can write some text in this text box and...
0
2990
by: Jeova Almeida | last post by:
Hello, I created a simple web service for testing purpose in Visual Studio 2005: <%@ WebService Language="C#" CodeBehind="~/App_Code/Service.cs" Class="WSTest" %> using System;
0
1313
by: Jeova Almeida | last post by:
Hello, I created a simple web service for testing purpose in Visual Studio 2005: <%@ WebService Language="C#" CodeBehind="~/App_Code/Service.cs" Class="WSTest" %> using System;
0
7673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8109
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6263
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2085
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.