|
-
Dec 1st, 2002, 07:48 PM
#1
Thread Starter
Hyperactive Member
access and ADO - simple example
Hi,
does anyone have a simple example, or know where to find one, for the following:
* Using an SQL statement to retrieve data from a table
* being able to explicitly say which field you wish to see (like the old recordset.fields("fieldname") method
all the examples i can find only relate to SQL server and not to access.
thanks all
"The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.
Windows & Web Developer
Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
Sutherland Shire, Sydney Australia
www.stingrae.com.au
Developer of Arnold - Gym & Martial Arts Database Management System
www.gymdatabase.com.au
-
Dec 2nd, 2002, 04:28 AM
#2
Addicted Member
retreive data from Access tables
hope this helps. This retreives the next student no from table
Public Function NextStudentNoGet() As Long
'get next Student no
Dim sSql As String
Dim cn As New OleDb.OleDbConnection(dbcConnection)
cn.Open()
'set sql string to reflect search criteria
sSql = "SELECT LastStudent FROM Startup WHERE ID = 1"
'open the ADO.NET Datareader
Dim cmd As New OleDb.OleDbCommand(sSql, cn)
Dim drd As OleDb.OleDbDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
drd.Read()
NextStudentNoGet = ToNum(drd!laststudent) + 1
drd.Close()
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|