Forums
This topic is locked
Updating Checkboxes
Posted 28 Apr 2004 23:19:14
1
has voted
28 Apr 2004 23:19:14 Carol Helbig posted:
I am updating a record using a SQL command behavior. It works well except for the check boxes. Does any one know how to write the command? I'm using asp pages with a SQL server db. Replies
Replied 29 Apr 2004 18:22:59
29 Apr 2004 18:22:59 Vince Baker replied:
Can you give us a sample of your code, not sure what your problem is.
Can you elaborate a bit?
Regards
Vince
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
Can you elaborate a bit?
Regards
Vince
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 29 Apr 2004 19:26:40
29 Apr 2004 19:26:40 Carol Helbig replied:
This code is what I've right now. everything works except bolGCA which is a true/false field updated by a check box. I don't get an error message it just does not change the field to true.
<%
if(Request.QueryString("lstGeneral"
<> ""
then cmdUpdateQIMS__formGeneral = Request.QueryString("lstGeneral"
if(Request.QueryString("lstDescriptive"
<> ""
then cmdUpdateQIMS__formDescriptive = Request.QueryString("lstDescriptive"
if(Request.QueryString("lstDetail"
<> ""
then cmdUpdateQIMS__formDetail = Request.QueryString("lstDetail"
if(Request.QueryString("txtID"
<> ""
then cmdUpdateQIMS__formID = Request.QueryString("txtID"
if(Request.QueryString("chkGCA"
<> ""
then cmdUpdateQIMS__formGCA = "1"
response.write(cmdUpdateQIMS__formGCA)
%>
<%
set cmdUpdateQIMS = Server.CreateObject("ADODB.Command"
cmdUpdateQIMS.ActiveConnection = MM_qims_conn_STRING
cmdUpdateQIMS.CommandText = "UPDATE tblQIMSDetail SET txtDefGeneral = '" + Replace(cmdUpdateQIMS__formGeneral, "'", "''"
+ "', txtDefDescribe = '" + Replace(cmdUpdateQIMS__formDescriptive, "'", "''"
+ "', txtDefDetail = '" + Replace(cmdUpdateQIMS__formDetail, "'", "''"
+ "', bolGCA = '" + Replace(cmdUpdate__formGCA, "'", "''"
+ "' WHERE txtGuideLocation + Cast(lngTrackingNumber As VarChar) = '" + Replace(cmdUpdateQIMS__formID, "'", "''"
+ "' "
cmdUpdateQIMS.CommandType = 1
cmdUpdateQIMS.CommandTimeout = 0
cmdUpdateQIMS.Prepared = true
cmdUpdateQIMS.Execute()
%>
<%
if(Request.QueryString("lstGeneral"



if(Request.QueryString("lstDescriptive"



if(Request.QueryString("lstDetail"



if(Request.QueryString("txtID"



if(Request.QueryString("chkGCA"


response.write(cmdUpdateQIMS__formGCA)
%>
<%
set cmdUpdateQIMS = Server.CreateObject("ADODB.Command"

cmdUpdateQIMS.ActiveConnection = MM_qims_conn_STRING
cmdUpdateQIMS.CommandText = "UPDATE tblQIMSDetail SET txtDefGeneral = '" + Replace(cmdUpdateQIMS__formGeneral, "'", "''"





cmdUpdateQIMS.CommandType = 1
cmdUpdateQIMS.CommandTimeout = 0
cmdUpdateQIMS.Prepared = true
cmdUpdateQIMS.Execute()
%>
Replied 28 May 2004 23:39:43
28 May 2004 23:39:43 Carol Helbig replied:
Resolved the problem. After a lot of playing with the code I relized that I had not enter a value for if the box was checked. Sometimes it's the simple things that humble you.