Microsoft Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to "front-end" an access dbase that I created. I have gone through all kinds of articles and technet information regarding connecting to my database and that sort of thing. I have successfully connected to it (with an OLEDB Connection) but I do not know how to pull data from it. The database has a main Table (Servers) with various columns in it, specifically one named [Server Name]. I want to be able to have a form where I can enter a Server name and then it returns all the data from the other fields (Serial number, description, etc) into text boxes.

Could someone please help me with a real example as opposed to articles that I don't understand. I also tried to figure it out using the VB.NET Resource kit, but I don't understand their examples as everything is in SQL statements.

Please help!

Sarah
System Administrator
 
Sarah,
For this you would want something like the following using a DataReader
Dim srch as String
srch = String.Format("SELECT fld1, fld2, ... FROM Servers WHERE ([Server
Name] = '{0}') ", stringvarWithServerName)
Dim cmd as new OleDbCommand(srch, myConnection)
Dim rdr as DataReader
rdr = cmd.ExecuteReader
If rdr.Read() ' see if data returned for the specified server
otherwise Read() will be false
' do something with the fields
End If
This requires you to have a connection defined as myConnection and you
should put the fields you desire back in place of fld1, fld2, ... above.
I think you should get a copy of "ADO.NET Core Reference" by David
Sceppa (MS Press) as it has some good examples in both C# and VB.NET and it
also explains the reasoning behind using the various types of items.

You may have better luck asing in
microsoft.public.dotnet.framework.adonet for these types of questions about
data.

Ron Allen
Sarah said:
I am trying to "front-end" an access dbase that I created. I have gone
through all kinds of articles and technet information regarding connecting
to my database and that sort of thing. I have successfully connected to it
(with an OLEDB Connection) but I do not know how to pull data from it. The
database has a main Table (Servers) with various columns in it, specifically
one named [Server Name]. I want to be able to have a form where I can enter
a Server name and then it returns all the data from the other fields (Serial
number, description, etc) into text boxes.
Could someone please help me with a real example as opposed to articles
that I don't understand. I also tried to figure it out using the VB.NET
Resource kit, but I don't understand their examples as everything is in SQL
statements.
 
Sarah said:
I am trying to "front-end" an access dbase that I created. I have
gone through all kinds of articles and technet information regarding
connecting to my database and that sort of thing. I have successfully
connected to it (with an OLEDB Connection) but I do not know how to
pull data from it. The database has a main Table (Servers) with
various columns in it, specifically one named [Server Name]. I want
to be able to have a form where I can enter a Server name and then it
returns all the data from the other fields (Serial number,
description, etc) into text boxes.

Could someone please help me with a real example as opposed to
articles that I don't understand. I also tried to figure it out using
the VB.NET Resource kit, but I don't understand their examples as
everything is in SQL statements.

Have you already visited the ADO.NET group and asked there for VB.NET
examples? If not, here it is: microsoft.public.dotnet.framework.adonet
 
a faster and simpler way to do this is to use Access Forms Wizard. (or the Reporting wiz)
use a drop down to select the server name and populate other fields.
(unless ofcourse VB.NET is a requirement)
 
Hi Sarah,

Accoording to the resource kit.

If you change everywhere where is written SqlClient.SQL in Oledb.Oledb or
when there is not that SQLclient just SQL in Oledb you have almost every
sample for access.

The only thing that you have really to change are the connections strings in
the startsections.

This is for a access database.
\\\
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\db1.mdb")
///

I hope this helps?

Cor
I am trying to "front-end" an access dbase that I created. I have gone
through all kinds of articles and technet information regarding connecting
to my database and that sort of thing. I have successfully connected to it
(with an OLEDB Connection) but I do not know how to pull data from it. The
database has a main Table (Servers) with various columns in it, specifically
one named [Server Name]. I want to be able to have a form where I can enter
a Server name and then it returns all the data from the other fields (Serial
number, description, etc) into text boxes.
Could someone please help me with a real example as opposed to articles
that I don't understand. I also tried to figure it out using the VB.NET
Resource kit, but I don't understand their examples as everything is in SQL
statements.
 
Back
Top