Eric Barro
ebarro at afsweb.com
Sun May 2 11:24:06 CDT 2004
John, Here's the "equivalent" code snippet for .NET Sub GetData(CommandText as string) 'we use the sqldata reader; for ms access use OleDBDataReader which has the same properties and syntax Dim myData As SQLDataReader 'this is the corresponding connection object Dim myConnection As New SqlConnection(ConnectionString) 'this is the corresponding command object Dim myCommand As New SqlCommand(CommandText, myConnection) myConnection.Open() 'this is the corresponding rst.open statement myData = myCommand.ExecuteReader() 'this is the corresponding do while not rst.eof statement While myData.Read() 'and this is where we grab the recordset values and assign to form controls or variables myFormField.text = myData("myFieldName") End While End Sub --- Eric Barro Senior Systems Analyst Advanced Field Services (208) 772-7060 http://www.afsweb.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of John W. Colby Sent: Sunday, May 02, 2004 7:53 AM To: VBA Subject: [dba-VB] VB.Net I need to know the syntax for just setting up access to data from code. In DAO you just dimmed a db and a recordset: dim db as dao.database dim rst as dao.database set db = currentdb set rst = db.openrecordset() etc. I know there are three parts to vb.net and can set them up with the wizard, but I want to be able to "just do it" from code as well. Anyone know how? John W. Colby www.ColbyConsulting.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.665 / Virus Database: 428 - Release Date: 4/21/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.665 / Virus Database: 428 - Release Date: 4/21/2004