473,398 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Accessing Access

I'm looking for the simplest example of VB.net to read/write a minimal MS
Access.database. Something like put date in textbox1, click button1, get
rainfall total in textbox2. For updates, fill in textboxes 1&2 and click
button2 to store new data in Access.

No creating classes or objects. Just a clean, quick and dirty example so I
can figure this out. Many Thanks.
Nov 21 '05 #1
2 947
Hi Stephen,
There are a number of samples in the Visual Basic.Net Resource Kit, that you
can download (free) from Microsoft or can get on CD.

But to get the simple solution you are asking for, you might prefer to use
Access IDE as the User Interface to the Access (MDB) database, rather than
Dot Net.

Also I am using a book "Visual Basic .NET COMPLETE" from SYBEX. It isn't a
great book if you are starting from scratch but if you have some VBA or VB
knowledge it gives some explanation and examples to move to Dot Net.

Doug
"Stephen" <sw******@notmail.com> wrote in message
news:OA**************@TK2MSFTNGP14.phx.gbl...
I'm looking for the simplest example of VB.net to read/write a minimal MS
Access.database. Something like put date in textbox1, click button1, get
rainfall total in textbox2. For updates, fill in textboxes 1&2 and click
button2 to store new data in Access.

No creating classes or objects. Just a clean, quick and dirty example so I
can figure this out. Many Thanks.

Nov 21 '05 #2
I just knocked up this example, which uses the northwind database. The text
box will display Nancy ( one of the employees ) hope this helps.

Dim ConStr As String = "Provider = Microsoft.Jet.OLEDB.4.0;Data
Source=..\Northwind.mdb;User Id=admin;Password="
Dim SelectString As String
Dim Con As New OleDb.OleDbConnection
Dim SelectCmd As New OleDb.OleDbCommand
Dim Da As New OleDb.OleDbDataAdapter
Dim Table As New DataTable

SelectString = "SELECT * FROM EMPLOYEES"
SelectCmd.CommandText = SelectString
SelectCmd.Connection = Con

Da.SelectCommand = SelectCmd
Con.ConnectionString = ConStr
Try
Con.Open()
Da.Fill(Table)

Catch ex As OleDb.OleDbException
MessageBox.Show(ex.Message)
Finally
Con.Close()
End Try

Me.TextBox1.Text = Table.Rows(0).Item(2).ToString()

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Stephen" <sw******@notmail.com> wrote in message
news:OA**************@TK2MSFTNGP14.phx.gbl...
I'm looking for the simplest example of VB.net to read/write a minimal MS
Access.database. Something like put date in textbox1, click button1, get
rainfall total in textbox2. For updates, fill in textboxes 1&2 and click
button2 to store new data in Access.

No creating classes or objects. Just a clean, quick and dirty example so I
can figure this out. Many Thanks.

Nov 21 '05 #3

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

Similar topics

36
by: Thomas | last post by:
after spending countless hours trying, i give up and hope to get some help in here. on server1 i got the web myweb.com with my test.asp. in the test.asp, i'm trying to read a file from an UNC...
3
by: prodirect | last post by:
Hi all, I hope someone can help me. I've recently created a database and wanted to put it up on an ftp sight so that multiple people could access the same tables at the same time from different...
3
by: Vivek Sharma | last post by:
Hi, I have created a dropdownlist as a web user control. I am using its multiple instances on the webpage. How do I access the selectedValue of each instance? All the instances have different...
1
by: CS Wong | last post by:
Hi, I have a page form where form elements are created dynamically using Javascript instead of programatically at the code-behind level. I have problems accessing the dynamically-created...
0
by: Joergen Bech | last post by:
Fairly new to ASP.NET 1.1. Getting the error below when running application on a web server outside of my control, but only the first time I run it: 1. After a long period of inactivity (or...
5
by: Daniel Corbett | last post by:
I am trying to save a file dynamically created in a webpage. I get the following headers, but cannot figure out how to save the attachment. I am basically trying to replicate what internet...
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
4
by: raj_genius | last post by:
I hav two queries, whc are as follows: FIRSTLY: is it possible to access the controls(by name) of a parent form(MDI) from its child forms??if yes then how??plzz provide a coded example in VB if...
3
by: Nathan Sokalski | last post by:
I have a validator that I wrote by inheriting from BaseValidator. At certain points in the code, I need to access other controls on the page containing the validator. I have the IDs of these...
2
by: =?Utf-8?B?SklNLkgu?= | last post by:
Accessing AD in ASP.Net 1. It sees I can I access Active Directory catalog from asp.net, is the version of AD important for this? 2. Do I need to have a domain user for that or IIS will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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...
0
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,...
0
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...

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.