473,606 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

import the decoded information/data into Microsoft Acess

17 New Member
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
Expand|Select|Wrap|Line Numbers
  1. Imports System.Data.OleDb
  2.  
  3. Public Class Form1
  4. Dim WithEvents serialPort As New IO.Ports.SerialPort
  5. Dim Data As String
  6. Dim buffer As String
  7. Dim Handphone_number As String
  8. Dim datetime As String
  9. Dim i As Integer
  10. Dim j As Integer
  11. Dim k As Integer
  12. Dim msg$
  13. Dim Content As String
  14.  
  15. Const HEADER = """REC UNREAD"""
  16. Const EOM = "EOM"
  17. Private Const cnstr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = carpark.mdb"
-------------------------------------------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.  
  3.  
  4. Timer1.Enabled = True
  5.  
  6. Try
  7. With serialPort
  8. .PortName = "COM12"
  9. .BaudRate = 115200
  10. .Parity = IO.Ports.Parity.None
  11. .DataBits = 8
  12. .StopBits = IO.Ports.StopBits.One
  13. End With
  14. serialPort.Open()
  15.  
  16. MsgBox(" connected.")
  17. Try
  18. serialPort.Write("ATE" + vbCr)
  19.  
  20.  
  21. Catch ex As Exception
  22. MsgBox(ex.ToString)
  23. End Try
  24.  
  25.  
  26. Catch ex As Exception
  27. MsgBox(ex.ToString)
  28. End Try
  29.  
  30.  
  31. End Sub
-------------------------------------------------------------------------------------------------------------------

Expand|Select|Wrap|Line Numbers
  1. Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  2.  
  3. Try
  4. serialPort.Write("AT+CMGL=""REC UNREAD""" & vbCr)
  5.  
  6. Catch ex As Exception
  7. MsgBox(ex.ToString)
  8. End Try
  9.  
  10.  
  11. 'MSComm1.Output = "AT+CMGL=""REC UNREAD""" & vbCr
  12. End Sub
--------------------------------------------------------------------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. Private Sub Decode(ByVal m As String)
  2. Dim timestr As String
  3. Dim datestr As String
  4. Dim car_plate As String
  5.  
  6.  
  7. i = InStr(1, m, """")
  8. If (i > 0) Then
  9. j = InStr(i + 1, m, """")
  10. If (j > 0) Then
  11. Handphone_number = Mid(m, i + 1, j - i - 1)
  12. MsgBox("The Handphone number is:" + Handphone_number)
  13.  
  14.  
  15. i = InStr(j + 1, m, """")
  16. If (i > 0) Then
  17. j = InStr(i + 1, m, """")
  18. If (j > 0) Then
  19. datetime = Mid(m, i + 1, j - i - 1)
  20. datestr = Mid(datetime, 1, 8)
  21. timestr = Mid(datetime, 10, 8)
  22. MsgBox("The date is: " + datestr)
  23. MsgBox("The time is: " + timestr)
  24.  
  25.  
  26. car_plate = Mid(m, j + 1)
  27. MsgBox("The car plate number is: " + car_plate)
  28.  
  29. End If
  30. End If
  31.  
  32. End If
  33. End If
  34. End Sub
-------------------------------------------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. Private Sub DataReceived( _
  2. ByVal sender As Object, _
  3. ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _
  4. Handles serialPort.DataReceived
  5.  
  6. Dim somemore As Boolean
  7.  
  8. buffer = buffer + serialPort.ReadExisting
  9. somemore = True
  10. Do While somemore = True
  11.  
  12. i = InStr(buffer, HEADER)
  13. If (i > 0) Then 'beginning of message found
  14.  
  15. j = InStr(i, buffer, EOM)
  16. If (j > 0) Then 'end of message found
  17.  
  18. msg$ = Mid(buffer, i + Len(HEADER), j - i - Len(HEADER))
  19. MsgBox(msg, vbInformation, "TEST")
  20.  
  21. Call Decode(msg$)
  22. buffer = Mid(buffer, j + Len(EOM))
  23. If Len(buffer) = 0 Then
  24. somemore = False
  25. End If
  26.  
  27. Else
  28. somemore = False
  29. End If
  30. Else
  31. somemore = False
  32. End If
  33. Loop
  34.  
  35. End Sub
-------------------------------------------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. Private Sub executeDataCommand(ByVal s As String)
  2. Dim cmd As OleDbCommand
  3. Dim cn As New OleDbConnection(cnstr)
  4.  
  5. cn.Open()
  6. cmd = New OleDbCommand(s, cn)
  7. cmd.ExecuteNonQuery()
  8. End Sub
-------------------------------------------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. Private Function executeDataRead(ByVal s As String) As OleDbDataReader
  2. Dim rd As OleDbDataReader
  3. Dim cmd As OleDbCommand
  4. Dim cn As New OleDbConnection(cnstr)
  5.  
  6. cn.Open()
  7. cmd = New OleDbCommand(s, cn)
  8.  
  9. rd = cmd.ExecuteReader()
  10. executeDataRead = rd
  11. End Function
  12.  
  13. End Class
-------------------------------------------------------------------------------------------------------------------
Sep 26 '07 #1
1 1463
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
Could you please put your code into [code] tags?
What issue are u really facing?
You are already reading an Access file right?

Cheers
Sep 26 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
11352
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...
2
3069
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...
2
1823
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)
4
6087
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...
11
2436
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...
0
1765
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...
4
2417
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...
1
1902
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...
6
26296
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...
0
8015
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8439
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8430
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8094
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,...
0
8305
tracyyun
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...
0
6770
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5966
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3930
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...
0
1296
bsmnconsultancy
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...

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.