Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parameterized query using ADO and VB6.0
Message
From
07/01/1999 15:02:13
 
 
To
28/12/1998 06:30:51
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Miscellaneous
Thread ID:
00170691
Message ID:
00173737
Views:
32
>We made a Parameterized Sql command (command1) in dataenvironment with the
>following SQL statment:
>SELECT * FROM Table Where COD_PROD = ?
>
>We use this Command object in many bound controls into our form. When we run
>the form, the Initialize event do:
>Environment.Command1("01") && define the initial parameter value like
>"01"
>
>It's works well, but now a want to change the parameter to "02". For this,
>in a commandbutton.click we use the following code:
>
>Environment.rsCommand1.Close && we close the recodset
>Environment.Command1("02") && change whe parameter to "02"
>
>At this point, we can see from DEBUG that the recodset object was changed.
>After access the SQL server the recordset have the new resultsets (now with
>COD_PROD = "02").
>BUT THE PROBLEM IS....
>
>all bound controls doesn´t work....
>the DBGrid is showing the old resultsets (COD_PROD = "01"), all my textboxes
>too.
>To change it we run :
>Grid.SourceName = Grid.SourceName
>So the grid works (showing the new resultset -> COD_Prod = "02"), but the
>all bound controls doesn´t.
>We try to use Requery command in recordset, but it´s result in a error
>message...
>
>After the command "Environment.Command1("02")" all bound controls doesn´t
>work any more....
>
>How can we resolve this problem?


Instead of closing your RecordSet and rebuilding it, issue a requery.

Where oAcN is the Object reference to your recordset.

Call oAcN.Requery() (You won't need the parenthesis unless you want to pass a parameter to requery) *** Passing a parameter to requery does absolutely nothing ***

Regards,

Jason
Jason Tryon
Senior Systems Analyst / Technical Lead
eBusiness / iPage
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform