Home All Groups Group Topic Archive Search About
Author
10 Dec 2006 6:37 AM
John
How do I input and retrieve data from tables in an .mdb file? I use vb.net

Author
10 Dec 2006 5:17 AM
RobinS
Which version, 2003 or 2005?

Robin S.
------------------------
Show quote
"John" <some***@microsoft.com> wrote in message
news:7gLeh.43$z_7.19@newsfe08.lga...
> How do I input and retrieve data from tables in an .mdb file? I use
> vb.net
>
Author
10 Dec 2006 6:10 AM
Scott M.
OleDBConnection instantiated & configured
OleDBCommand (one for each DB operation you wish to perform) instantiated &
configured.
OleDBDataReader or DataSet instance for reading data



Show quote
"John" <some***@microsoft.com> wrote in message
news:7gLeh.43$z_7.19@newsfe08.lga...
> How do I input and retrieve data from tables in an .mdb file? I use vb.net
>
Author
10 Dec 2006 7:13 AM
Cor Ligthert [MVP]
John,

In endless ways, if your question is so simple than buy a book.

The newest I know is this one.
http://www.hitchhikerguides.net:80/

Bill is one of the oldest mdb supporters on these website.

Cor


Show quote
"John" <some***@microsoft.com> schreef in bericht
news:7gLeh.43$z_7.19@newsfe08.lga...
> How do I input and retrieve data from tables in an .mdb file? I use vb.net
>
Author
10 Dec 2006 7:33 PM
William (Bill) Vaughn
Ah, I think Cor is being sarcastic. My most recent book does not really talk
about .MDB (JET/Access) databases at all but my previous book "ADO and
ADO.NET Examples and Best Practices" did.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

Show quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:uNodppCHHHA.4904@TK2MSFTNGP04.phx.gbl...
> John,
>
> In endless ways, if your question is so simple than buy a book.
>
> The newest I know is this one.
> http://www.hitchhikerguides.net:80/
>
> Bill is one of the oldest mdb supporters on these website.
>
> Cor
>
>
> "John" <some***@microsoft.com> schreef in bericht
> news:7gLeh.43$z_7.19@newsfe08.lga...
>> How do I input and retrieve data from tables in an .mdb file? I use
>> vb.net
>>
>
>
Author
11 Dec 2006 5:31 AM
Cor Ligthert [MVP]
Bill,

No I was not, as I have wrote often I don't read any book, Internet is my
main source especially MSDN in the case of dotNet. Beside that does my
general knowledge help me. I just refer to your knowledge I see in this
newsgroup. And I know you as somebody who was in past not so criticizing ADO
and DOA as some others did.

No sarcastic at all, it was truly meant.
(One day I will probably read your book all was it only because I am
curious, I write you soon why I did not accept your offer direct).

Cor

Show quote
"William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> schreef in bericht
news:ejKPZIJHHHA.1276@TK2MSFTNGP04.phx.gbl...
> Ah, I think Cor is being sarcastic. My most recent book does not really
> talk about .MDB (JET/Access) databases at all but my previous book "ADO
> and ADO.NET Examples and Best Practices" did.
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speaker
> www.betav.com/blog/billva
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________
> Visit www.hitchhikerguides.net to get more information on my latest book:
> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
> -----------------------------------------------------------------------------------------------------------------------
>
> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
> news:uNodppCHHHA.4904@TK2MSFTNGP04.phx.gbl...
>> John,
>>
>> In endless ways, if your question is so simple than buy a book.
>>
>> The newest I know is this one.
>> http://www.hitchhikerguides.net:80/
>>
>> Bill is one of the oldest mdb supporters on these website.
>>
>> Cor
>>
>>
>> "John" <some***@microsoft.com> schreef in bericht
>> news:7gLeh.43$z_7.19@newsfe08.lga...
>>> How do I input and retrieve data from tables in an .mdb file? I use
>>> vb.net
>>>
>>
>>
>
>
Author
10 Dec 2006 4:26 PM
John
VB 2003. This is what I wrote and it does not work;

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

"John" <some***@microsoft.com> wrote in message
news:7gLeh.43$z_7.19@newsfe08.lga...
> How do I input and retrieve data from tables in an .mdb file? I use vb.net
>

I have a book by the way, and it only tells me how to create a data grid,
and display single records.
Author
10 Dec 2006 2:58 PM
Norman Yuan
Have you tried to debug your code to see what is happening by place a break
point in Button1_Click event handler? What is the point to use
Try...Catch... but does nothing in Catch clause?

If you place a breakpoint there and hit F5, you can easily find out which
line of code throw you into Catch clause; furthermore, if you do something
in Catch... clause like this:

Try
....
Catch ex As Exception
    MessageBox.Show(ex.Message)
End Try

then from the exception message, you probably had already known what was
wrong before asking question here

Show quote
"John" <some***@microsoft.com> wrote in message
news:hUTeh.114$Vq.92@newsfe12.lga...
> VB 2003. This is what I wrote and it does not work;
>
> 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
>
> "John" <some***@microsoft.com> wrote in message
> news:7gLeh.43$z_7.19@newsfe08.lga...
>> How do I input and retrieve data from tables in an .mdb file? I use
>> vb.net
>>
>
> I have a book by the way, and it only tells me how to create a data grid,
> and display single records.
>
Author
10 Dec 2006 4:54 PM
Cor Ligthert [MVP]
John,

Why are you using that reader, there is no need for that, that does the
DataAdapter.

So it can be.


> Imports System.Data.OleDb
>
> Public Class Form2
> Inherits System.Windows.Forms.Form
>
> Dim cn As OleDbConnection
> Dim cmd As OleDbCommand

> 'WINDOWS GENERATED
>
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
dim ds as New Dataset
dim cn as
New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\Documents and Settings\Name\Desktop\FillMe.mdb;")

Dim da as New OleDbDataAdapter("select * from MainTable", cn)

da.Fill(ds)

Textbox1.DataBinding.Add("Text",ds.Table(0),"Col1")
Textbox2.DataBinding.Add("Text",ds.Table(0),"Col2")
Textbox3.DataBinding.Add("Text",ds.Table(0),"Col3")

End Sub

'Col1 is the first fieldname in your Jet database etc,

Done in this message so watch typos.

I hope this helps,

cor
Author
11 Dec 2006 1:54 AM
John
Ok, so I created a connection from my .mdb file into my program using a
datagrid:

Dim ds As DataSet = New DataSet
DataGrid1.DataSource = DataSet11.DefaultViewManager

How do I input and retrieve data from tables in an .mdb file? I use vb.net
2003
Author
11 Dec 2006 3:21 AM
Scott M.
John,

The questions you are asking do not have just one simple answer, nor are any
of the possible scenarios simple "couple of lines of code" solutions.

In general, you need Command objects to perform any C.R.U.D. (create, read,
update & delete) actions against your database.  Now, that leaves you with 2
choices in ADO.NET:

    Create & configure them yourself.
    Use a DataAdapter & configure them that way.

Of course, you'll need a connection to the database that the command objects
can use....

And then you have to think about any return data from your CRUD actions,
that leaves you with
    DataReaders
    DataTables
    DataSets

In short (too late!), it sounds like you need to take a look at the ADO.NET
objects more closely and begin to understand what each represents and how to
properly configure each.

Asking "how do I update my database" is actually a very vauge quesiton and
you shouldn't expect a meaningful response from such a quesiton.

Good luck.

Scott


Show quote
"John" <some***@microsoft.com> wrote in message
news:rc0fh.4117$Ah6.1693@newsfe10.lga...
> Ok, so I created a connection from my .mdb file into my program using a
> datagrid:
>
> Dim ds As DataSet = New DataSet
> DataGrid1.DataSource = DataSet11.DefaultViewManager
>
> How do I input and retrieve data from tables in an .mdb file? I use vb.net
> 2003
>
Author
11 Dec 2006 5:34 AM
Cor Ligthert [MVP]
John,

If you were not multiposting in the way as you do but especially because you
are using Outlook Express crossposting it was much easier to help you.

Refering to my answer in another newsgroup where you have placed your
question takes to much time and makes my answer even more not understandable
for others who are searching than normally.

Cor

Show quote
"John" <some***@microsoft.com> schreef in bericht
news:rc0fh.4117$Ah6.1693@newsfe10.lga...
> Ok, so I created a connection from my .mdb file into my program using a
> datagrid:
>
> Dim ds As DataSet = New DataSet
> DataGrid1.DataSource = DataSet11.DefaultViewManager
>
> How do I input and retrieve data from tables in an .mdb file? I use vb.net
> 2003
>

AddThis Social Bookmark Button