General information
Category:
Database DAO/RDO/ODBC/ADO
Title:
Parameterized query using ADO and VB6.0
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?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only