Scott Marcus
marcus at tsstech.com
Fri Jul 22 09:14:24 CDT 2005
Does this help in any way? Private Function GetEmployeeType() As DataTable Dim Conn As New SqlConnection(SQLConnStr) Dim Cmd As SqlCommand Dim Reader As SqlDataReader Dim SQL As String Dim TypeTable As New DataTable Dim empColumn As DataColumn Dim KeyColumns(1) As DataColumn Dim dvEmployees As DataView Dim rowVals(1) As Object empColumn = New DataColumn("EMPNO", GetType(String)) TypeTable.Columns.Add(empColumn) KeyColumns(0) = empColumn TypeTable.PrimaryKey = KeyColumns TypeTable.Columns.Add("TYPE", GetType(Integer)) 'Returns the employee type (8 or 10) for hours in a given week an employee works per day SQL = "SELECT RIGHT('000' + LTRIM(RTRIM(EMPLOYEENO)),4) AS EMPNO, JOB_CODE FROM TOOL..VISIB.EMPLOYEES WHERE STATUS = 'A' AND (JOB_CODE = '8' OR JOB_CODE = '10') ORDER BY EMPNO" Conn.Open() Cmd = New SqlCommand(SQL, Conn) Reader = Cmd.ExecuteReader While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Conn.Close() GetEmployeeType = TypeTable End Function -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/