Param question
Posted: Mon  17 Jul 2006 20:30
				
				Hello!
I create 14 parameters like the 1 line of code below in my form's constructor.
MyQuery_Site_ID->Params->CreateParam(ftInteger, "pram_ut", ptInput);
In another section of code when a user pushes a button I have this code.
Form1->MyQuery_Site_ID->ParamByName("pram_ut")->AsInteger = Form1->MyTable_Version_Utility->RecordCount -2;
After this line of code I generate a very long SQL statement which depends on what the user selects (many checkboxes).
The SQL statement works the first time...but then when I try a second time the SQL statement I generate raises a exception that says:
Project Site_Tracker.exe raised exception class EDatabaseError with message 'Parameter 'pram_ut' not found'. Prcess stopped. Use Step or Run to continue.
Why does this happen?
Does the params property flush out the old params that were created in it when a SQL statement is run in my query?
Also question #2.
When you highlight a TMyQuery object in the design mode...is there any reason why you can't put parameters in the dialog box that pops up? (All the controls on the parameters tab are disabled)
---Dave
			I create 14 parameters like the 1 line of code below in my form's constructor.
MyQuery_Site_ID->Params->CreateParam(ftInteger, "pram_ut", ptInput);
In another section of code when a user pushes a button I have this code.
Form1->MyQuery_Site_ID->ParamByName("pram_ut")->AsInteger = Form1->MyTable_Version_Utility->RecordCount -2;
After this line of code I generate a very long SQL statement which depends on what the user selects (many checkboxes).
The SQL statement works the first time...but then when I try a second time the SQL statement I generate raises a exception that says:
Project Site_Tracker.exe raised exception class EDatabaseError with message 'Parameter 'pram_ut' not found'. Prcess stopped. Use Step or Run to continue.
Why does this happen?
Does the params property flush out the old params that were created in it when a SQL statement is run in my query?
Also question #2.
When you highlight a TMyQuery object in the design mode...is there any reason why you can't put parameters in the dialog box that pops up? (All the controls on the parameters tab are disabled)
---Dave