**Hi, i've a problem to load data from SQL in my MSHFlexGrid. This is my code:
Option Explicit
Dim rs As Recordset
Private Sub btnEmpieza_Click()
rs.Open "SELECT CorridaVigenciaEncabezado.CVE_Titulo, CorridaVigenciaEncabezado.CVE_Mail " _
& "FROM CorridaVigenciaEncabezado INNER JOIN Usuarios " _
& "ON CorridaVigenciaEncabezado.USU_IdSolicitado = Usuarios.Codigo " _
& "INNER JOIN Solicitud on CorridaVigenciaEncabezado.CVE_Titulo = Solicitud.ANTITSOL " _
& "WHERE Solicitud.ANDNICLI =19002108 ", Cn, adOpenKeyset, adLockReadOnly
Grilla
rs.Close
End Sub
Private Sub Form_Load()
Set rs = New Recordset
rs.CursorLocation = adUseServer
End Sub
Private Sub Estructura()
GrillaDatos.Cols = 2
GrillaDatos.TextMatrix(0, 1) = "Título"
GrillaDatos.TextMatrix(0, 2) = "Mail"
GrillaDatos.ColWidth(0) = 1000
GrillaDatos.ColWidth(1) = 1000
GrillaDatos.ColAlignment(0) = 4
GrillaDatos.ColAlignment(1) = 4
End Sub
Private Sub Grilla()
Dim i As Integer
GrillaDatos.Clear
Estructura
GrillaDatos.Rows = rs.RecordCount + 1
i = 1
rs.MoveFirst
Do While rs.EOF = False
i = i + 1
GrillaDatos.TextMatrix(i, 0) = rs!CVE_Titulo
GrillaDatos.TextMatrix(i, 1) = rs!CVE_Mail
rs.MoveNext
i = i + 1
Loop
rs.Close
End Sub
But when i press button, it shows the next error:
runtime error Run time error'-2147217887(80040e21) odbc driver doesnt support requested properties.
In this line:
rs.Open "SELECT CorridaVigenciaEncabezado.CVE_Titulo, CorridaVigenciaEncabezado.CVE_Mail " _
& "FROM CorridaVigenciaEncabezado INNER JOIN Usuarios " _
& "ON CorridaVigenciaEncabezado.USU_IdSolicitado = Usuarios.Codigo " _
& "INNER JOIN Solicitud on CorridaVigenciaEncabezado.CVE_Titulo = Solicitud.ANTITSOL " _
& "WHERE Solicitud.ANDNICLI =19002108 ", Cn, adOpenKeyset, adLockReadOnly
So, can anyone tells me what's wrong with my code? 'cause i don't understand what's wrong. i had readed about this problem and i don't know to do
Just in case the ODBC driver doesn't support the CursorType, try changing the CursorType in the Open
method of the Recordset object.
You can try with adOpenStatic
or adOpenUnspecified
.
..., Cn, adOpenStatic, adLockReadOnly