Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update Db table button

Status
Not open for further replies.

asrg

Technical User
Jul 11, 2011
9
0
0
GB
Hi im trying to updat an Access Db table (tasking)using a button.
It does work if im updating a text field but not when Im updating a true/false field. The code that im stuck on is "&update=true". This will place the text "true" into a text field but wont change the conditon in the True/False field

Code
Head >>>>>>>>>>>>>>>
<% If Request.QueryString("update") <> "" Then %>
<%
strConnectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Set cnn = Server.CreateObject("ADODB.Connection")
cnn.Open strConnectionString
strSQL = "UPDATE tasking SET tasking.advis = '"&(Request.QueryString("update"))&"' WHERE taskID = "&(Request.QueryString("taskID"))&""
cnn.Execute strSQL,,adCmdText + adExecuteNoRecords
cnn.Close
%>
<% Else %>
<% End If %>
----------------------------------------
Body
<A href="solvetask.asp?taskID=<%=(openlist.Fields.Item("taskID").Value)%>&update=true"><img src="../images/icons/buttons/t_yes.gif" width="20" height="14" border="0"></A>

Any Ideas ?
 
waiting1962: the query string "update" should have no effect on the SQL that is being built.

asrg: I would add "response.write strSQL" to look at the actual SQL string being excuted.
 
Hi .. all the code works for updating a text field in the table, so inserting text is fine.orks great

Im just not sure how to up date a yes/no field (formatted as True/False) ...
I assumed that putting the word true as the update would work. "solvetask.asp?taskID=<%=(openlist.Fields.Item("taskID").Value)%>&update=true"

It nomaly works in a form field input as "value="True"

confused ?
 
You do not send the word "true" as a string, you send the constant that represents a true value.

So you convert (cast) the string to the appropriate value with value = cBool(string)




Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
you can do this:
update My_table
set my_field = yes;
without any quotes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top