CFGRID ISSUE

I have a cfgrid and everytime I try to click a checkbox on a boolean feild and update the grid I get this error:

Invalid data for CFSQLTYPE CF_SQL_BIT.

WHY!!!!!??? ITS DRIVING ME CRAZY!
LVL 3
judsonmusicAsked:
Who is Participating?
 
Scott BennettConnect With a Mentor Manager TechnologyCommented:
Try doing something like this to convert the Yes/No formatted fields into 1/0 format:


<cfif isdefined('form.submit')>
		<cfloop from="1" to="#arraylen(form.allusers.display)#" index="i">
			<cfif form.allusers.display[i] eq "true">
				<cfset form.allusers.display[i] = "1">
			<cfelse>
				<cfset form.allusers.display[i] = "0">
			</cfif>
		</cfloop>
		<cfloop from="1" to="#arraylen(form.allusers.newsletter)#" index="i">
			<cfif form.allusers.newsletter[i] eq "true">
				<cfset form.allusers.newsletter[i] = "1">
			<cfelse>
				<cfset form.allusers.newsletter[i] = "0">
			</cfif>
		</cfloop>
		<cfloop from="1" to="#arraylen(form.allusers.CD)#" index="i">
			<cfif form.allusers.CD[i] eq "true">
				<cfset form.allusers.CD[i] = "1">
			<cfelse>
				<cfset form.allusers.CD[i] = "0">
			</cfif>
		</cfloop>
      <cfgridupdate grid="allusers" datasource="mssqlcf_judsonmusic" tablename="members" keyonly="yes">
</cfif>
 
<cfquery name="allusers" datasource="mssqlcf_judsonmusic">
SELECT *
FROM members
ORDER BY lastLoggedIn DESC
</cfquery>
 
 <cfform name="form1" method="post" preloader="yes" format="html">
    <cfgrid name="allusers" query="allusers" selectmode="edit" format="applet" width="100%" height="650" insert="yes" delete="yes" >
<cfgridcolumn name="ID"                   display="no"       select="no">
<cfgridcolumn name="fstnam"             width="80">
<cfgridcolumn name="lstnam"             width="80">
<cfgridcolumn name="display"             width="50"        type="boolean">
<!---<cfgridcolumn name="admin"                   width="50"             type="boolean">--->
<cfgridcolumn name="newsletter"       width="50"        type="boolean">
<cfgridcolumn name="CD"                   width="50"             type="boolean">
<cfgridcolumn name="username"             width="100">
<cfgridcolumn name="password"            width="100">
<cfgridcolumn name="email"                   width="100">
<cfgridcolumn name="hear"                   width="100">
<cfgridcolumn name="favjudsong"       width="100">
<cfgridcolumn name="quote"                   width="100">
<cfgridcolumn name="zodiac"             width="100">
<cfgridcolumn name="picture"             width="100">
<cfgridcolumn name="city"                   width="100">
<cfgridcolumn name="state"                   width="100">
<cfgridcolumn name="fantype"             width="100">
<cfgridcolumn name="lastLoggedIn"       width="100">
<cfgridcolumn name="purchased"             width="100">
<cfgridcolumn name="street"             width="100">
<cfgridcolumn name="zip"                   width="100">
  </cfgrid>

Open in new window

0
 
Scott BennettManager TechnologyCommented:
is the grid passing back the boolean value in "Yes/No" "True/False" or "1/0" format?  It may need to be converted to 1/0 format to work with the cfqueryparam tag in your query
0
 
judsonmusicAuthor Commented:
it is a true or false format this is my code:

<cfif isdefined('form.submit')>
      <cfgridupdate grid="allusers" datasource="mssqlcf_judsonmusic" tablename="members" keyonly="yes">
</cfif>

<cfquery name="allusers" datasource="mssqlcf_judsonmusic">
SELECT *
FROM members
ORDER BY lastLoggedIn DESC
</cfquery>

 <cfform name="form1" method="post" preloader="yes" format="html">
    <cfgrid name="allusers" query="allusers" selectmode="edit" format="applet" width="100%" height="650" insert="yes" delete="yes" >
<cfgridcolumn name="ID"                   display="no"       select="no">
<cfgridcolumn name="fstnam"             width="80">
<cfgridcolumn name="lstnam"             width="80">
<cfgridcolumn name="display"             width="50"        type="boolean">
<!---<cfgridcolumn name="admin"                   width="50"             type="boolean">--->
<cfgridcolumn name="newsletter"       width="50"        type="boolean">
<cfgridcolumn name="CD"                   width="50"             type="boolean">
<cfgridcolumn name="username"             width="100">
<cfgridcolumn name="password"            width="100">
<cfgridcolumn name="email"                   width="100">
<cfgridcolumn name="hear"                   width="100">
<cfgridcolumn name="favjudsong"       width="100">
<cfgridcolumn name="quote"                   width="100">
<cfgridcolumn name="zodiac"             width="100">
<cfgridcolumn name="picture"             width="100">
<cfgridcolumn name="city"                   width="100">
<cfgridcolumn name="state"                   width="100">
<cfgridcolumn name="fantype"             width="100">
<cfgridcolumn name="lastLoggedIn"       width="100">
<cfgridcolumn name="purchased"             width="100">
<cfgridcolumn name="street"             width="100">
<cfgridcolumn name="zip"                   width="100">
  </cfgrid>


<br />
      <br />
      You must click submit to save all changes!!!!
      <input type="submit"  name="submit" value="submit"/>
      <br />
</cfform>
</cfif>
</body>
</html>
0
All Courses

From novice to tech pro — start learning today.