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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Scott BennettManager 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.