473,513 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple (?) DB Connection problem

Hi all,

I am trying to connect to an Access database on my local machine which
has a table named lastupdate, from this table I want to return the
value to a messagebox of a field named last update which contains the
date that the database was last updated.

I have tried to accomplish this as follows:

Imports System
Imports System.Data

Module Module1
Sub main()
Dim sConnectionString, sSQL As String
sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Documents and Settings\Derek\My Documents\Seaton
JFC.mdb;Persist Security Info=False"
sSQL = "SELECT last update FROM lastupdate"

Dim connUP As New OleDb.OleDbConnection(sConnectionString)
Dim cmdUP As New OleDb.OleDbCommand(sSQL, connUP)
Dim drUP As OleDb.OleDbDataReader
connUP.Open()
drUP = cmdUP.ExecuteReader
Do While drUP.Read
MsgBox(drUP.Item("last update"))
Loop
drUP.Close()
connUP.Close()

End Sub
End Module

When I try to run this, I get the following error:

An unhandled exception of type 'System.Data.OleDb.OleDbException'
occurred in system.data.dll

When I break, the error is at the line : drUP = cmdUP.ExecuteReader

What am I doing wrong here, this is driving me insane.

TIA

Del.
Nov 20 '05 #1
3 965
Hi Meissa,

On first sight I think it is your the name of your table
"lastupdate"

In your program you say "last update"

I do not know if it is possible, however the name update will probably for
sure give you problems.

And than it has to be enclosed with [last update]

I hope this helps?

Cor
Nov 20 '05 #2
Hi Meissa

Use try catch block like thi

tr

catch ex as exceptio
msgbox ex.stackTrac
end tr

See what message it is giving, if you see the message you can solve the problem by urself, if you are not mail the message which u are getting

I will tell u a solution. U can mail me at sa************@hotmail.com

With regards

Sadha Sivam S
Nov 20 '05 #3
Hi Cor,

Thanks for your help; I renamed the table and this worked fine.

I appreciate your help.

"Cor Ligthert" <no**********@planet.nl> wrote in message news:<OR**************@TK2MSFTNGP12.phx.gbl>...
Hi Meissa,

On first sight I think it is your the name of your table
"lastupdate"

In your program you say "last update"

I do not know if it is possible, however the name update will probably for
sure give you problems.

And than it has to be enclosed with [last update]

I hope this helps?

Cor

Nov 20 '05 #4

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

Similar topics

4
15954
by: Dariusz | last post by:
I am a beginner in PHP and MySQL, and am working through a book and various online tutorials on PHP and MySQL and now stuck - installed everything on "localhost" and it all works fine. My question...
13
2331
by: LRW | last post by:
Having a problem getting a onSubmit function to work, to where it popsup a confirmation depending on which radiobutton is selected. Here's what I have: function checkdel() { if...
9
342
by: Alex | last post by:
I run the following and I get a messagebox telling me the connection is closed (OK so far) and then it crashes. The error message is: SQL Server does not exist or access denied. SQL Manager is...
1
1935
by: Mark Ogilvie | last post by:
Hi I'm new to C#, and have a problem which I'm sure is simple. I have the following 3 lines of code: string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data...
0
2153
by: Harley | last post by:
Hello, I am just learning the tcp/ip functions etc under vb.net so please look over me if this is obviouse. I have been all over looking into any functions that I didn't totaly understand and...
2
4128
by: Brad | last post by:
Where is the connection string stored for a simple Crystal Report Application. What I am trying to do is: 1. Create a simple report from a Firebird database using an ODBC connection 2. Need to...
5
2252
by: samadams_2006 | last post by:
I'm having a problem in accessing a Microsoft Access Database in a VB.NET Web Application. It's so straight forward, I thought I'd walk you through all the details here: 1) I have a .NET Web...
0
1382
by: contactme | last post by:
Hi, Is it possible to open concurrent connections using Net::IMAP::Simple library ? My IMAP server allows 4 connections per ip, so I am having following problems while using Net::IMAP::Simple and...
2
1101
by: kj | last post by:
I'm sure this is a simple, but recurrent, problem for which I can't hit on a totally satisfactory solution. As an example, suppose that I want write a module X that performs some database...
3
1476
by: Blarneystone | last post by:
Ok, I've got a simple access 97 db. named S_tracking.mdb It has two tables 1- Jobs 2- Employees I've set up the references: Imports System.Data.OleDb Imports System.IO Imports System.data
0
7265
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,...
0
7171
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7388
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,...
0
5692
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,...
1
5095
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...
0
4751
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...
0
3240
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...
0
3228
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
461
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...

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.