Scott Marcus
marcus at tsstech.com
Fri Jul 22 10:02:39 CDT 2005
Bear in mind that I could have called the Reader object 'rst'(or any
valid variable name, Reader is not a reserved word) and the code would
be exactly the same. That's why it was a little confusing what you were
asking. Plus I jumped in the middle of the thread.
-----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:22 AM
To: dba-vb at databaseadvisors.com
Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset
This
While Reader.Read()
rowVals(0) = Reader("EMPNO")
rowVals(1) = Reader("JOB_CODE")
' Add and return the new row.
TypeTable.Rows.Add(rowVals)
End While
Was what I was looking for. Apparently the column is the "default
property"
for the reader object. Thus Reader("SomeFldName") is "the same as"
rst("FieldName") from ADO.
It is absolutely insane how much time it takes to get up to speed on a
new
object model.
Speaking of which, does anyone have a good source for a hypertext object
model diagram for .net, that shows the object model graphically but
allows
drilling down to look at the pieces?
John W. Colby
www.ColbyConsulting.com
Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/
-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus
Sent: Friday, July 22, 2005 10:14 AM
To: dba-vb at databaseadvisors.com
Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset
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/
_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com
_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com