Help with JET_SCHEMA_USERROSTER

  • Thread starter Thread starter JLuis Estrada
  • Start date Start date
J

JLuis Estrada

Its is possible to use it with MSADO 2.8?

'coz I saw and sample, but it use 2.6.

does anyone knows about it?
 
I triedto use it on mi App, but it always return -1 in the .RecordCount,
anyone know why.

I run the same App with ADO 2.6 and it return perfectly all the user
connected to the DB.
 
Private Function ComprobarConexion() As Boolean
Dim Cn As New ADODB.Connection, Rs As ADODB.Recordset

Const JET_SCHEMA_USERROSTER As String =
"{947bb102-5d43-11d1-bdbf-00c04fb92675}"

Cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Trim(RutasSoftal.Db) & ";Persist Security Info=False"
a = Cn.State
Set Rs = Cn.OpenSchema(adSchemaProviderSpecific, , JET_SCHEMA_USERROSTER)


ComprobarConexion = Rs.RecordCount > 1

Rs.Close: Set Rs = Nothing
Cn.Close: Set Cn = Nothing

End Function

The problem is that .RecordCount always return -1.

I use the MSADO 2.8
 
Hi,


Forward only cursor/recordset do not know and do not bother themselves
trying to know how many records are in the set. The recordset count
returns -1 (should it been better if it would return NULL? but then, the
property should be have been a variant, another source of problem).

Hoping it may help,
Vanderghast, Access MVP
 
So, thats an error from ADO?

Well, I changed my code and did this:

Private Function ComprobarConexion() As Boolean
Dim Cn As New ADODB.Connection, Rs As ADODB.Recordset
Dim a As Integer

Const JET_SCHEMA_USERROSTER As String =
"{947bb102-5d43-11d1-bdbf-00c04fb92675}"

Cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Trim(RutasSoftal.Db) & ";Persist Security Info=False"
a = Cn.State
Set Rs = Cn.OpenSchema(adSchemaProviderSpecific, , JET_SCHEMA_USERROSTER)
While Not Rs.EOF
a = a + 1
Rs.MoveNext
Wend


ComprobarConexion = a > 1

Rs.Close: Set Rs = Nothing
Cn.Close: Set Cn = Nothing

End Function

and It worked so well. Its not the best programming practice, but if works,
its ok.

Tnx for your help
 
You could probably use:

Set Rs = Cn.OpenSchema(adSchemaProviderSpecific, , JET_SCHEMA_USERROSTER)
Rs.MoveLast
ComprobarConexion = Rs.RecordCount > 1

I wouldn't have expected it to work in ADO 2.6 and not in ADO 2.8.
 
Back
Top