Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21096

ms access stored procedures

$
0
0
Hi. I am trying to run through VB6 some stored procedures in an access file.

When i run the stored procedure directly from the ms access file, it runs correctly and returns the correct number of results ( rows ).
However when i run the stored procedure through my VB program it returns a much smaller number of rows ( 2 instead of about 15 ), as if it were running another one, which would indeed return two rows.

I don't know what am I doing wrong:

VB6 code:

Code:


    Set CnDataEnn = New ADODB.Connection
    CnDataEnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;" & _
                                          "Data Source=" & InstallDir & "database.mdb" & ";Jet OLEDB:Database Password=xxxxxx;"

    CnDataEnn.open
    CnDataEnn.CursorLocation = adUseClient
   
    Set CmdEnn = New ADODB.Command
    CmdEnn.CommandText = "lookliketxtouter"
    CmdEnn.CommandType = adCmdStoredProc

    Set PrmEnn1 = CmdEnn.CreateParameter("pText1", adBSTR, adParamInput)
    PrmEnn1.Value = pText1
    CmdEnn.Parameters.Append PrmEnn1
   

    Set CmdEnn.ActiveConnection = CnDataEnn
    Set rsWordEnn = CmdEnn.Execute
   
    MsgBox (rsWordEnn.RecordCount & ":" & pText1)

so i get rsWordEnn.RecordCount = 2 insted of about 15.

The "lookliketxtouter" code is:

Code:

PARAMETERS pText1 Text ( 255 );
SELECT entries.en_lect, entries.en_main, entries.en_opref, entries.en_id, entries.en_meros, entries.en_family, entries.en_header
FROM entries
WHERE (((entries.en_id) In (SELECT en_family FROM lookliketxtinner)));

( "lookliketxtinner" is another SP, which provides to the former SP a list of IDs, which also is wrong!! it should be a list of 15 IDs instead of 2 IDs. However when i run even this SP manually through the ms access file it runs correctly, providing 15 IDs )

Is it possible that some weird caching is taking place ? because the two rows returned by the SP, are the rows that another SP called "fam1outer" actually DOES return.

I can't figure out what is going on. some help would be greatly appreciated.

p.s. pText1 is a user provided string

Viewing all articles
Browse latest Browse all 21096

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>