How to execute a Select statement from a SQL View

Hello there,I’m tyring to pickup data from a SQL view. I run this sql statement " SELECT * FROM VW_NL_ALLENTRIES" (where VW_NL_ALLENTRIES is a view. The recordSet count is always -1

despite the fact that the view contains data.

Cheers

Subject: How to execute a Select statement from a SQL View

Could you post the code/code segment that makes this call?

Subject: RE: How to execute a Select statement from a SQL View

argQuery = "SELECT * FROM VIEW_X"Trainer, myTrainer is other classes

'------------------------------

Function getTrainers( argQuery As String ) As Variant

Dim x As Long, columns List As Variant, persons() As Trainer, pers As myTrainer

Dim i As Integer

Dim rsListObj As Variant

Dim ConnStr As String

Dim connOH As Variant

ConnStr = “Server=ncehdsk1\smc;Database=NEW_TR_MG_SYS_VERSION_0;UID=EtapNotesClient;pwd=domino”

Set connOH = CreateObject(“ADODB.Connection”)

Set rsListObj = CreateObject(“ADODB.RecordSet”)

connOH.Provider = “sqloledb”

connOH.Open( ConnStr)

With rsListObj

.open argQuery , connOH

If .EOF  Then Exit Function

Redim persons( 0 )

Do While Not .EOF

    With .Fields

    For x = 0 To ( .Count - 1 )			      With .Item( x )

      If Isnull(.Value) Then 				i =1

     End If

						    If i =1 Then					columns( .Name)  = ""

	i=0

    Else

	columns( .Name) = .Value

						    End If

					End With

Next

Set pers = New myTrainer( columns )

End With

Set persons( Ubound( persons ) ) = pers Redim Preserve persons( Ubound( persons) + 1) 

.MoveNext 	

Loop

If Ubound( persons ) > 0 Then Redim Preserve persons( Ubound( persons) - 1 )

	.close			

End With

getTrainers = persons

End Function