r1xliquid
Posts: 41
|
| Posted: 07/26/2007, 1:45 PM |
|
I cannot tell whats happening with my grid. It appears as tho the default values i input into the dialouge box for the stored procedure (datasource) of my grid always take priority over the form values that should be passed. Has anyone experienced this?
for example i have 5 bit parameters(0/1) that are passed to the procedure. they correspond to checkboxes on my grid. No matter if the check box is checked or not it codecharge executes with '0' (default value defined in codecharge for the SP)
the checkboxes are defined as checked value = 1/ unchecked value = 0
This is in an includable page, so i dont know if that is causing a problem.
if anyone has experience problems with stored procedures with bit values and checkboxes please let me know!
|
 |
 |
Megan
Posts: 35
|
| Posted: 02/25/2008, 9:24 PM |
|
Did you ever get a response on this? I'm having the exact same problem - I think. I have a checkbox that I want to pass a true/false value to a stored procedure. I've configured the procedure so that the value is a "bit", the checkbox is set for boolean, checked = 1 / unchecked = 0. It's almost like the results are backwards. When the checkbox is checked, it gives me the records where the value in the table is 0; if the box is unchecked, I get no results (which is incorrect). I execute my procedure directly on the SQL server, and it works as it should, so it's not the procedure. Something in CodeCharge is not passing the data correctly.
|
 |
 |
Megan
Posts: 35
|
| Posted: 02/27/2008, 5:10 PM |
|
I finally figured this out, if anyone is interested. First off, I found out that HTML passes a NULL value when the checkbox is not selected. It doesn't matter what you have in the "Unchecked Value" on the properties of the checkbox. So, I had to add a couple of lines of code into the stored procedure to check for this.
So, here's the settings for the checkbox properties:
Data Type: Integer
Checked Value: 1
Unchecked Value: 0
Default Value: 0 (depends on what you want)
Then, my procedure looked something like this:
ALTER PROCEDURE [dbo].[ProcedureName]
@s_Checkbox int
AS
BEGIN
SET NOCOUNT ON;
--check checkbox for NULL
IF @s_Checkbox IS NULL
BEGIN
SET @s_Checkbox = 0
END
SELECT dbo.TableName.*
FROM dbo.TableName
WHERE (Field= @s_Checkbox)
|
 |
 |
|