G
G.Esmeijer
Friends,
I would like to access a a query from out a vb6 funtion.
The query in Acees delivers the right result.
however I do not get it working fromout vb6
Who can help?
What is wrong in the code?
The follwoing contains the code and the query
functie findLocations(ByVal locatie as string)
Dim locatieCode As String
Dim prm As New ADODB.Parameter
Dim m_rs As New ADODB.Recordset
Dim cmd As New ADODB.Command
locatieCode = UCase(locatie)
m_rs.close
m_rs.CursorLocation = adUseClient
prm.Direction = adParamInput
prm.Type = adChar
prm.Size = 7
prm.Value = locatieCode
cmd.Parameters.Append prm
cmd.ActiveConnection = cnnLOC '// active connection
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "ZoekLocatie"
Set m_rs = cmd.Execute
If m_rs.RecordCount > 0 Then
' do something with it
' ....
End If
m_rs.close
End Function
'// this is the query in Access
'***********************************
SELECT Id, Locatie, PinCode, Soort
FROM LOCATIE
WHERE LOCATIE Like [@locatie]
ORDER BY Locatie;
I would like to access a a query from out a vb6 funtion.
The query in Acees delivers the right result.
however I do not get it working fromout vb6
Who can help?
What is wrong in the code?
The follwoing contains the code and the query
functie findLocations(ByVal locatie as string)
Dim locatieCode As String
Dim prm As New ADODB.Parameter
Dim m_rs As New ADODB.Recordset
Dim cmd As New ADODB.Command
locatieCode = UCase(locatie)
m_rs.close
m_rs.CursorLocation = adUseClient
prm.Direction = adParamInput
prm.Type = adChar
prm.Size = 7
prm.Value = locatieCode
cmd.Parameters.Append prm
cmd.ActiveConnection = cnnLOC '// active connection
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "ZoekLocatie"
Set m_rs = cmd.Execute
If m_rs.RecordCount > 0 Then
' do something with it
' ....
End If
m_rs.close
End Function
'// this is the query in Access
'***********************************
SELECT Id, Locatie, PinCode, Soort
FROM LOCATIE
WHERE LOCATIE Like [@locatie]
ORDER BY Locatie;