hi
im actually doing on a SMS application using Visual Basic.Net whereby the objective is to allow the user to send a SMS to the visual basic programme and i should decode out the hp no, car plate, time in,time out and date.And finally import the data(hp number, car plate number....as stated earlier) into Miscrosoft Access.I have already successfully decoded the data and May I know how i can import the decoded information/data into Microsoft Acess so that it can be stored as database in order to be retrived in the later part.Below is my programme.
Thanks -
Imports System.Data.OleDb
-
-
Public Class Form1
-
Dim WithEvents serialPort As New IO.Ports.SerialPort
-
Dim Data As String
-
Dim buffer As String
-
Dim Handphone_number As String
-
Dim datetime As String
-
Dim i As Integer
-
Dim j As Integer
-
Dim k As Integer
-
Dim msg$
-
Dim Content As String
-
-
Const HEADER = """REC UNREAD"""
-
Const EOM = "EOM"
-
Private Const cnstr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = carpark.mdb"
------------------------------------------------------------------------------------------------------------------- -
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
-
-
Timer1.Enabled = True
-
-
Try
-
With serialPort
-
.PortName = "COM12"
-
.BaudRate = 115200
-
.Parity = IO.Ports.Parity.None
-
.DataBits = 8
-
.StopBits = IO.Ports.StopBits.One
-
End With
-
serialPort.Open()
-
-
MsgBox(" connected.")
-
Try
-
serialPort.Write("ATE" + vbCr)
-
-
-
Catch ex As Exception
-
MsgBox(ex.ToString)
-
End Try
-
-
-
Catch ex As Exception
-
MsgBox(ex.ToString)
-
End Try
-
-
-
End Sub
------------------------------------------------------------------------------------------------------------------- -
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
-
-
Try
-
serialPort.Write("AT+CMGL=""REC UNREAD""" & vbCr)
-
-
Catch ex As Exception
-
MsgBox(ex.ToString)
-
End Try
-
-
-
'MSComm1.Output = "AT+CMGL=""REC UNREAD""" & vbCr
-
End Sub
-------------------------------------------------------------------------------------------------------------------------------------------- -
Private Sub Decode(ByVal m As String)
-
Dim timestr As String
-
Dim datestr As String
-
Dim car_plate As String
-
-
-
i = InStr(1, m, """")
-
If (i > 0) Then
-
j = InStr(i + 1, m, """")
-
If (j > 0) Then
-
Handphone_number = Mid(m, i + 1, j - i - 1)
-
MsgBox("The Handphone number is:" + Handphone_number)
-
-
-
i = InStr(j + 1, m, """")
-
If (i > 0) Then
-
j = InStr(i + 1, m, """")
-
If (j > 0) Then
-
datetime = Mid(m, i + 1, j - i - 1)
-
datestr = Mid(datetime, 1, 8)
-
timestr = Mid(datetime, 10, 8)
-
MsgBox("The date is: " + datestr)
-
MsgBox("The time is: " + timestr)
-
-
-
car_plate = Mid(m, j + 1)
-
MsgBox("The car plate number is: " + car_plate)
-
-
End If
-
End If
-
-
End If
-
End If
-
End Sub
------------------------------------------------------------------------------------------------------------------- -
Private Sub DataReceived( _
-
ByVal sender As Object, _
-
ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _
-
Handles serialPort.DataReceived
-
-
Dim somemore As Boolean
-
-
buffer = buffer + serialPort.ReadExisting
-
somemore = True
-
Do While somemore = True
-
-
i = InStr(buffer, HEADER)
-
If (i > 0) Then 'beginning of message found
-
-
j = InStr(i, buffer, EOM)
-
If (j > 0) Then 'end of message found
-
-
msg$ = Mid(buffer, i + Len(HEADER), j - i - Len(HEADER))
-
MsgBox(msg, vbInformation, "TEST")
-
-
Call Decode(msg$)
-
buffer = Mid(buffer, j + Len(EOM))
-
If Len(buffer) = 0 Then
-
somemore = False
-
End If
-
-
Else
-
somemore = False
-
End If
-
Else
-
somemore = False
-
End If
-
Loop
-
-
End Sub
------------------------------------------------------------------------------------------------------------------- -
Private Sub executeDataCommand(ByVal s As String)
-
Dim cmd As OleDbCommand
-
Dim cn As New OleDbConnection(cnstr)
-
-
cn.Open()
-
cmd = New OleDbCommand(s, cn)
-
cmd.ExecuteNonQuery()
-
End Sub
------------------------------------------------------------------------------------------------------------------- -
Private Function executeDataRead(ByVal s As String) As OleDbDataReader
-
Dim rd As OleDbDataReader
-
Dim cmd As OleDbCommand
-
Dim cn As New OleDbConnection(cnstr)
-
-
cn.Open()
-
cmd = New OleDbCommand(s, cn)
-
-
rd = cmd.ExecuteReader()
-
executeDataRead = rd
-
End Function
-
-
End Class
-------------------------------------------------------------------------------------------------------------------
1 1463
Could you please put your code into [code] tags?
What issue are u really facing?
You are already reading an Access file right?
Cheers
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: TonyMontana |
last post by:
Hello,
I've the following problem. I've to read out the data of a custom
application. I think (I'm not sure) this application is using a
Paradox DB to store it's information. I don't know it exactly cause
I'm not familar with paradox at all, but I've found files like *.db,
*.mb, *.px, *.xg*, *.yg* !!!
I need the infomation from this files to combine it with other data
stored in SQL 2000. I'm tried DTS to import the Data but I've got an...
|
by: David Berry |
last post by:
Hi All. I'm looking for any help or sample code that can show me how to make a file import wizard in ASP.NET (VB preferred) like the one that MS Access uses. I'm working on a web site where the user has the ability to upload a file (.txt or .csv). The data in the file may be comma delaminated, tab delaminated, fixed width etc (we don't know).
What I'd like to create is something like MS Access uses to import an Excel file into the...
|
by: Oswaldo Gómez RCN |
last post by:
Hy all,
We have two databases with similar information (both, made with MS Acess).
Both, A and B, have - in some cases - the same information, names etc.
Database A has the following fields. (4,000 entries)
Name-Phone-Addres-Email-Country-Language-University-Age
Database Be has the following fields: (2,000 entries)
|
by: Bruce W. Roeser |
last post by:
All,
I'm reading a book by Charles Petzold (Programming VS.Net). Pretty good
content but am confused about the difference. From the text:
----------------------------------------------------------------------------------------------------------------------------------------------------------
The @ Import Directive
Next to @ Page, the directive that ASP.NET programmers use the most is @
Import. The @ Import directive is ASP.NET's...
|
by: kaisersose1995 |
last post by:
Hi,
I've got an import procedure working, using a standard import
specification to import a .csv file into a temporary table.
The problem i'm having is that i have 4 different sets of borrower
details on the same line e.g. B1-Title, B1-Initials, B1-Surname,
B2-Title, B2-Initials, B2-Surname, etc.
all linked to my main borrower table via an unique account number.
My 1st append query matches which account numbers are new to the main...
| |
by: Taftheman |
last post by:
Hi, I have created an import function with many different store procedures. This application uses VB6. The import file originally comes in an Acess database. The DTS pakacge is used to import all the data from the Acess database in to a Temp Table in sql server 2000. I made the DTS, by matching the access database table fields with the fields in the temp table. The good thing is it works so information is being imported into the Temp table where...
|
by: Roberto Mora |
last post by:
I have not done programming in a very long time and what is worst, I never learned VB. Although my job does not require this knowledge, I cam across a problem that although it seemed simple it has become a nightmare.
There is a log that gets generated in a regular basis and need to put most , but not all its contents in a DB (new or existent, it doesn't matter). because the fields that I need to cover are vertically and there is junk in...
|
by: lokeshreddy16 |
last post by:
'this is my code plz guys help how to save data from vb 2005 and other this that i am able to view the data from acess but i am not able save to acess i dont whether my code for save is correct of not ( iam using vb2005 as front end and MS acess as by back end)
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the...
|
by: provor |
last post by:
Hello,
I have the following code that I am using when a user presses a button to import an excel file into a table. The code is hard coded to point to the correct table. This works great for this one table. My problem is I have two buttons I want to use this code for for the two buttons would put the data in different tables. I have tried copying and changing a few things and nothing will work for me. The code is set up in a module and then I...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |