Hi,
im desperately trying to import and store data from visual basic.net to microsoft access. Does anyone has any idea what codes i have to add in apart from adding the .Jet method as shown below?
Private Const cnstr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = carpark1.mdb"
If possible can u pls provide some relevant programming or access samples or examples?
U can contact me thru my email: shersky_venus@hotmail.com
Thx
8 2712
Hi,
im desperately trying to import and store data from visual basic.net to microsoft access. Does anyone has any idea what codes i have to add in apart from adding the .Jet method as shown below?
Private Const cnstr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = carpark1.mdb"
If possible can u pls provide some relevant programming or access samples or examples?
U can contact me thru my email: shersky_venus@hotmail.com
Thx
http://visualbasic.ittoolbox.com/gro...tabase-1595578 http://support.microsoft.com/kb/308278
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
-------------------------------------------------------------------------------------------------------------------
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
-------------------------------------------------------------------------------------------------------------------
if you decoded the data correctly then what is the problem in executing a simple INSERT query to insert your record into database.?? I cant understand your problem??? please explain the exact scenario...
if you decoded the data correctly then what is the problem in executing a simple INSERT query to insert your record into database.?? I cant understand your problem??? please explain the exact scenario...
For Query, may I know what statements do we have add in apart from the insert query?Im jus equipped with the basic knowledge about SQL statements and query.Can u show me some examples?
Thx
what is your current sql insert statement that you are using?
We can build up on that
cheers
what is your current sql insert statement that you are using?
We can build up on that
cheers
hi currently does not have any SQL statements.Im actually trying to insert record into database in Microsoft Access.Told that should use insert query.However, im not sure of how and what query statement to add in.Can anyone help me on that.Thx in advance
I see the followinf method which you have - Private Function executeDataRead(ByVal s As String) As OleDbDataReader
However there is no method calling this method.
s is your sql command
if you want to know more abt sql please check this site
cheers
May I know if I want to add in a INSERT INTO statement do I have to declare anything above in the VB.Net programme?example,
INSERT INTO Carpark_table (Carplate, date, TimeIn)
VALUES (car_plate, datestr, timestr)
when I debug the INSERT and VALUES are considered as errors where declarations are needed
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Doug Baroter |
last post by:
Hi,
One of my clients has the following situation. They use Access DB for
data update etc. some business functions while they also want to view
the Access data quickly and more efficiently in...
|
by: DCM Fan |
last post by:
Access 2K, SP3 on Windows 2K, SP4
All,
I have an import spec set up with quoted Identifiers and comma-separated
values. The text file is produced by a 3rd-party program of which I have no...
|
by: Dan |
last post by:
Could someone please help me with auto importing a series of data
files into an Access table. I tried to follow code given below in a
previous messagebut i'm getting error messages.
Here's my...
|
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...
|
by: NewbieSupreme |
last post by:
I'm using PHPMyAdmin on an Apache2Triad install (latest version; 5.x.x,
which installs PHP5 and PHPMyAdmin 2.8 as well). In Access, I exported a
table to a text file, tab-delimited, text qualifyer...
|
by: Earl Anderson |
last post by:
I guess I missed the boat on the logic for this one. Immediately upon
hitting "Import" in an
attempt to import an Excel file containing 7 columns of 'txt' formatted data
into AXP, I got a "Type...
|
by: qwer |
last post by:
import data from vb.net to miscrosoft access
--------------------------------------------------------------------------------
Hi,
im trying to import and store data from visual basic.net to...
|
by: qwer |
last post by:
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,...
|
by: a |
last post by:
Dear friends
I want import data from CSV file to mdb file How can I do that in vb.net?
|
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...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |