473,503 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retrieving info out of a MDB

After reading the tutorial from http://www.startvbdotnet.com/ado/msaccess.aspx I wrote this code in an attempt to get information from my MDB file called FillMe. The only table in that Access file is called MainTable;

Imports System.Data.OleDb

Public Class Form2
Inherits System.Windows.Forms.Form

Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader

'WINDOWS GENERATED

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
OleDbDataAdapter1.Fill(DataSet11)
End Sub
Private Sub exitbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitbutton.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\Name\Desktop\FillMe.mdb;")
'provider to be used when working with access database
cn.Open()
cmd = New OleDbCommand("select * from MainTable", cn)
dr = cmd.ExecuteReader
While dr.Read()
TextBox1.Text = dr(0)
TextBox2.Text = dr(1)
TextBox3.Text = dr(2)
'loading data into TextBoxes by column index
End While
Catch
End Try
dr.Close()
cn.Close()
End Sub
End Class

Is filling the data set when the form loads neccisary? How would I link the Data adapters and data sets I created to this form?
Dec 9 '06 #1
7 1133

"John" <so*****@microsoft.comwrote in message news:jk*************@newsfe09.lga...
After reading the tutorial from http://www.startvbdotnet.com/ado/msaccess.aspx I wrote this code in an attempt to get information from my MDB file called FillMe. The only table in that Access file is called MainTable;

Imports System.Data.OleDb

Public Class Form2
Inherits System.Windows.Forms.Form

Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader

'WINDOWS GENERATED

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
OleDbDataAdapter1.Fill(DataSet11)
End Sub
Private Sub exitbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitbutton.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\Name\Desktop\FillMe.mdb;")
'provider to be used when working with access database
cn.Open()
cmd = New OleDbCommand("select * from MainTable", cn)
dr = cmd.ExecuteReader
While dr.Read()
TextBox1.Text = dr(0)
TextBox2.Text = dr(1)
TextBox3.Text = dr(2)
'loading data into TextBoxes by column index
End While
Catch
End Try
dr.Close()
cn.Close()
End Sub
End Class

Is filling the data set when the form loads neccisary?

You've got to fill it sometime, so why not Page_Load?

How would I link the Data adapters and data sets I created to this form?

OleDbDataAdapter1.Fill(DataSet11)

Dec 9 '06 #2
When I click on the button, nothing happens, I dont know what is wrong
"Scott M." <s-***@nospam.nospamwrote in message news:e1****************@TK2MSFTNGP02.phx.gbl...

"John" <so*****@microsoft.comwrote in message news:jk*************@newsfe09.lga...
After reading the tutorial from http://www.startvbdotnet.com/ado/msaccess.aspx I wrote this code in an attempt to get information from my MDB file called FillMe. The only table in that Access file is called MainTable;

Imports System.Data.OleDb

Public Class Form2
Inherits System.Windows.Forms.Form

Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader

'WINDOWS GENERATED

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
OleDbDataAdapter1.Fill(DataSet11)
End Sub
Private Sub exitbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitbutton.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\Name\Desktop\FillMe.mdb;")
'provider to be used when working with access database
cn.Open()
cmd = New OleDbCommand("select * from MainTable", cn)
dr = cmd.ExecuteReader
While dr.Read()
TextBox1.Text = dr(0)
TextBox2.Text = dr(1)
TextBox3.Text = dr(2)
'loading data into TextBoxes by column index
End While
Catch
End Try
dr.Close()
cn.Close()
End Sub
End Class

Is filling the data set when the form loads neccisary?

You've got to fill it sometime, so why not Page_Load?

How would I link the Data adapters and data sets I created to this form?

OleDbDataAdapter1.Fill(DataSet11)

Dec 10 '06 #3
If you put a breakpoint in the code in the Button1_Click routine,
does it stop there? Or put a debug.writeline statement or something?
To tell you if it ever gets there?

Is this .Net 2003 or .Net 2005?
Robin S.
-------------
"John" <so*****@microsoft.comwrote in message news:nx************@newsfe12.lga...
When I click on the button, nothing happens, I dont know what is wrong
"Scott M." <s-***@nospam.nospamwrote in message news:e1****************@TK2MSFTNGP02.phx.gbl...

"John" <so*****@microsoft.comwrote in message news:jk*************@newsfe09.lga...
After reading the tutorial from http://www.startvbdotnet.com/ado/msaccess.aspx I wrote this code in an attempt to get information from my MDB file called FillMe. The only table in that Access file is called MainTable;

Imports System.Data.OleDb

Public Class Form2
Inherits System.Windows.Forms.Form

Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader

'WINDOWS GENERATED

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
OleDbDataAdapter1.Fill(DataSet11)
End Sub
Private Sub exitbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitbutton.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\Name\Desktop\FillMe.mdb;")
'provider to be used when working with access database
cn.Open()
cmd = New OleDbCommand("select * from MainTable", cn)
dr = cmd.ExecuteReader
While dr.Read()
TextBox1.Text = dr(0)
TextBox2.Text = dr(1)
TextBox3.Text = dr(2)
'loading data into TextBoxes by column index
End While
Catch
End Try
dr.Close()
cn.Close()
End Sub
End Class

Is filling the data set when the form loads neccisary?

You've got to fill it sometime, so why not Page_Load?

How would I link the Data adapters and data sets I created to this form?

OleDbDataAdapter1.Fill(DataSet11)

Dec 10 '06 #4
The breakpoints happen within the button1_click routine, but not within;

While dr.Read()

TextBox1.Text = dr(0)

TextBox2.Text = dr(1)

TextBox3.Text = dr(2)

End While

I guess thats why the data is'nt being written, but I dont know how to re-write it to make it work.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message news:bv******************************@comcast.com. ..
If you put a breakpoint in the code in the Button1_Click routine,
does it stop there? Or put a debug.writeline statement or something?
To tell you if it ever gets there?

Is this .Net 2003 or .Net 2005?
Robin S.
-------------
"John" <so*****@microsoft.comwrote in message news:nx************@newsfe12.lga...
When I click on the button, nothing happens, I dont know what is wrong
"Scott M." <s-***@nospam.nospamwrote in message news:e1****************@TK2MSFTNGP02.phx.gbl...

"John" <so*****@microsoft.comwrote in message news:jk*************@newsfe09.lga...
After reading the tutorial from http://www.startvbdotnet.com/ado/msaccess.aspx I wrote this code in an attempt to get information from my MDB file called FillMe. The only table in that Access file is called MainTable;

Imports System.Data.OleDb

Public Class Form2
Inherits System.Windows.Forms.Form

Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader

'WINDOWS GENERATED

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
OleDbDataAdapter1.Fill(DataSet11)
End Sub
Private Sub exitbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitbutton.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\Name\Desktop\FillMe.mdb;")
'provider to be used when working with access database
cn.Open()
cmd = New OleDbCommand("select * from MainTable", cn)
dr = cmd.ExecuteReader
While dr.Read()
TextBox1.Text = dr(0)
TextBox2.Text = dr(1)
TextBox3.Text = dr(2)
'loading data into TextBoxes by column index
End While
Catch
End Try
dr.Close()
cn.Close()
End Sub
End Class

Is filling the data set when the form loads neccisary?

You've got to fill it sometime, so why not Page_Load?

How would I link the Data adapters and data sets I created to this form?

OleDbDataAdapter1.Fill(DataSet11)

Dec 10 '06 #5
What if you try just doing *one* read and filling the textboxes,
rather than looping through the data reader?

Robin S.
------------------------
"John" <so*****@microsoft.comwrote in message news:9Z**************@newsfe12.lga...
The breakpoints happen within the button1_click routine, but not within;

While dr.Read()

TextBox1.Text = dr(0)

TextBox2.Text = dr(1)

TextBox3.Text = dr(2)

End While

I guess thats why the data is'nt being written, but I dont know how to re-write it to make it work.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message news:bv******************************@comcast.com. ..
If you put a breakpoint in the code in the Button1_Click routine,
does it stop there? Or put a debug.writeline statement or something?
To tell you if it ever gets there?

Is this .Net 2003 or .Net 2005?
Robin S.
-------------
"John" <so*****@microsoft.comwrote in message news:nx************@newsfe12.lga...
When I click on the button, nothing happens, I dont know what is wrong
"Scott M." <s-***@nospam.nospamwrote in message news:e1****************@TK2MSFTNGP02.phx.gbl...

"John" <so*****@microsoft.comwrote in message news:jk*************@newsfe09.lga...
After reading the tutorial from http://www.startvbdotnet.com/ado/msaccess.aspx I wrote this code in an attempt to get information from my MDB file called FillMe. The only table in that Access file is called MainTable;

Imports System.Data.OleDb

Public Class Form2
Inherits System.Windows.Forms.Form

Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader

'WINDOWS GENERATED

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
OleDbDataAdapter1.Fill(DataSet11)
End Sub
Private Sub exitbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitbutton.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\Name\Desktop\FillMe.mdb;")
'provider to be used when working with access database
cn.Open()
cmd = New OleDbCommand("select * from MainTable", cn)
dr = cmd.ExecuteReader
While dr.Read()
TextBox1.Text = dr(0)
TextBox2.Text = dr(1)
TextBox3.Text = dr(2)
'loading data into TextBoxes by column index
End While
Catch
End Try
dr.Close()
cn.Close()
End Sub
End Class

Is filling the data set when the form loads neccisary?

You've got to fill it sometime, so why not Page_Load?

How would I link the Data adapters and data sets I created to this form?

OleDbDataAdapter1.Fill(DataSet11)

Dec 10 '06 #6
John,

Wrote a complete solution in the other newsgroup you have posted too.

Cor
"John" <so*****@microsoft.comschreef in bericht news:9Z**************@newsfe12.lga...
The breakpoints happen within the button1_click routine, but not within;

While dr.Read()

TextBox1.Text = dr(0)

TextBox2.Text = dr(1)

TextBox3.Text = dr(2)

End While

I guess thats why the data is'nt being written, but I dont know how to re-write it to make it work.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message news:bv******************************@comcast.com. ..
If you put a breakpoint in the code in the Button1_Click routine,
does it stop there? Or put a debug.writeline statement or something?
To tell you if it ever gets there?

Is this .Net 2003 or .Net 2005?
Robin S.
-------------
"John" <so*****@microsoft.comwrote in message news:nx************@newsfe12.lga...
When I click on the button, nothing happens, I dont know what is wrong
"Scott M." <s-***@nospam.nospamwrote in message news:e1****************@TK2MSFTNGP02.phx.gbl...

"John" <so*****@microsoft.comwrote in message news:jk*************@newsfe09.lga...
After reading the tutorial from http://www.startvbdotnet.com/ado/msaccess.aspx I wrote this code in an attempt to get information from my MDB file called FillMe. The only table in that Access file is called MainTable;

Imports System.Data.OleDb

Public Class Form2
Inherits System.Windows.Forms.Form

Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader

'WINDOWS GENERATED

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
OleDbDataAdapter1.Fill(DataSet11)
End Sub
Private Sub exitbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitbutton.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\Name\Desktop\FillMe.mdb;")
'provider to be used when working with access database
cn.Open()
cmd = New OleDbCommand("select * from MainTable", cn)
dr = cmd.ExecuteReader
While dr.Read()
TextBox1.Text = dr(0)
TextBox2.Text = dr(1)
TextBox3.Text = dr(2)
'loading data into TextBoxes by column index
End While
Catch
End Try
dr.Close()
cn.Close()
End Sub
End Class

Is filling the data set when the form loads neccisary?

You've got to fill it sometime, so why not Page_Load?

How would I link the Data adapters and data sets I created to this form?

OleDbDataAdapter1.Fill(DataSet11)

Dec 10 '06 #7
thank you
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message news:et****************@TK2MSFTNGP04.phx.gbl...
John,

Wrote a complete solution in the other newsgroup you have posted too.

Cor
"John" <so*****@microsoft.comschreef in bericht news:9Z**************@newsfe12.lga...
The breakpoints happen within the button1_click routine, but not within;

While dr.Read()

TextBox1.Text = dr(0)

TextBox2.Text = dr(1)

TextBox3.Text = dr(2)

End While

I guess thats why the data is'nt being written, but I dont know how to re-write it to make it work.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message news:bv******************************@comcast.com. ..
If you put a breakpoint in the code in the Button1_Click routine,
does it stop there? Or put a debug.writeline statement or something?
To tell you if it ever gets there?

Is this .Net 2003 or .Net 2005?
Robin S.
-------------
"John" <so*****@microsoft.comwrote in message news:nx************@newsfe12.lga...
When I click on the button, nothing happens, I dont know what is wrong
"Scott M." <s-***@nospam.nospamwrote in message news:e1****************@TK2MSFTNGP02.phx.gbl...

"John" <so*****@microsoft.comwrote in message news:jk*************@newsfe09.lga...
After reading the tutorial from http://www.startvbdotnet.com/ado/msaccess.aspx I wrote this code in an attempt to get information from my MDB file called FillMe. The only table in that Access file is called MainTable;

Imports System.Data.OleDb

Public Class Form2
Inherits System.Windows.Forms.Form

Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader

'WINDOWS GENERATED

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
OleDbDataAdapter1.Fill(DataSet11)
End Sub
Private Sub exitbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitbutton.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\Name\Desktop\FillMe.mdb;")
'provider to be used when working with access database
cn.Open()
cmd = New OleDbCommand("select * from MainTable", cn)
dr = cmd.ExecuteReader
While dr.Read()
TextBox1.Text = dr(0)
TextBox2.Text = dr(1)
TextBox3.Text = dr(2)
'loading data into TextBoxes by column index
End While
Catch
End Try
dr.Close()
cn.Close()
End Sub
End Class

Is filling the data set when the form loads neccisary?

You've got to fill it sometime, so why not Page_Load?

How would I link the Data adapters and data sets I created to this form?

OleDbDataAdapter1.Fill(DataSet11)

Dec 12 '06 #8

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

Similar topics

3
4307
by: Dmitry Shaporenkov | last post by:
Hi all, I'd like to programmatically retrieve the directory of .NET framework binary tools (csc.exe, RegAsm.exe). What is the right way to do this? I can get InstallRoot via the Registry and...
8
4486
by: Steve | last post by:
Can anyone tell me the preferred method for writing and retrieving persistent information using .Net. Specifically, I am referring to information that you used to see in registry keys or .ini...
2
2275
by: Sagaert Johan | last post by:
Hi I have set the columreorder to true Is there a way to get/set the current columnorder, so i can restore the order from a saved setting ? Johan
0
1255
by: Kurt Ng | last post by:
Hi, y'all. I am working on retrieving file version info on a third party dll. I have used the FileVersionInfo class to retrieve all of the standard version information already such as...
13
3943
by: RHPT | last post by:
I am wanting to capture the XML posted by an InfoPath form with .NET, but I cannot figure out how to capture the XML stream sent back by the InfoPath form. With Classic ASP, I could just create an...
1
3877
by: tangus via DotNetMonster.com | last post by:
Hello all, I'm really struggling with getting some Active Directory code to work in ASP.NET. Can you please provide assistance? I am executing the following code: Dim enTry As DirectoryEntry =...
5
1961
by: Sanjay Pais | last post by:
I have a table with over 1.3 million rows. I am retrieving only 20 at a time using the with - over clauses In query analyser, the data is retrieved in under a second. When retrieving using the...
2
1115
by: Michel Vanderbeke | last post by:
Hello, When you get an error in a VB.NET program, is it possible to know what is the origin of the error. I assume it can be VB.NET, the framework, a database engine, the database itself...
4
2437
by: kaisersose1995 | last post by:
Hi, I'm trying to get Novell Netware information using vba into my access database and have no idea how to progress. Basically when i right click the properties on my computer the free space of a...
3
2119
by: dmorand | last post by:
I have a page where I'm using ajax to retrieve some employee info when a user clicks a "Retrieve Employee Info" button. The issue I'm having is that when the user updates the employee info,...
0
7205
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
7287
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
7468
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
5596
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
5023
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
4689
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
3180
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...
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
401
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.