Skip to main content
Inspiring
October 1, 2008
Question

Joining form field values and inserting into database

  • October 1, 2008
  • 3 replies
  • 246 views
Hi all

I have a form that has four text fields that need joining together before
being entered into the database.

Does anyone know how i can acheive this?
I'm using the DW command Behavior and the code below.
I've come up with the code directly below, but im not sure how to impliment
it.

Thanks
Andy

<% If Request("updateme") <>"" Then %>
<% Dim Cust_Ref
Cust_Ref = Request("cr1")&"/"& Request("cr2")&"/"& Request("cr3")&"/"&
Request("cr4") %>
<% end if
%>


<%
if(Request("Cust_ref") <> "") then Cal_Update__MMColParam11 =
Request("Cust_ref")
%>

<%

set Cal_Update = Server.CreateObject("ADODB.Command")
Cal_Update.ActiveConnection = MM_calcert_STRING
Cal_Update.CommandText = "UPDATE Calibrations SET Cust_Ref='" +
Replace(Cal_Update__MMColParam11, "'", "''") + "' WHERE Inst_ID = '" +
Replace(Cal_Update__MMColParam10, "'", "''") + "' "
Cal_Update.CommandType = 1
Cal_Update.CommandTimeout = 0
Cal_Update.Prepared = true
Cal_Update.Execute()
Response.Redirect("update_1.asp?InstID="&(RSCerts1.Fields.Item("Inst_ID").Value))
%>


This topic has been closed for replies.

3 replies

Inspiring
October 1, 2008
Andy wrote:
> It's ok guys - i've done it :-D
> I simply changed the code below to this:
> if(Request("Cust_ref") <> "") then Cal_Update__MMColParam11 =
> Request("cr1")&"/"& Request("cr2")&"/"& Request("cr3")&"/"& Request("cr4")
>
> For anyone else who may need it.

Well done Andy, you got there in the end, keep up the good work!

Dooza

--
Posting Guidelines
http://www.adobe.com/support/forums/guidelines.html
How To Ask Smart Questions
http://www.catb.org/esr/faqs/smart-questions.html
Inspiring
October 1, 2008
It's ok guys - i've done it :-D
I simply changed the code below to this:
if(Request("Cust_ref") <> "") then Cal_Update__MMColParam11 =
Request("cr1")&"/"& Request("cr2")&"/"& Request("cr3")&"/"& Request("cr4")

For anyone else who may need it.

Thanks
Andy



"Andy" <andy@work.com> wrote in message
news:gbvlo9$5ok$1@forums.macromedia.com...
> Forgot to mention that im using classic ASP - Access Database - DW 8
> Thanks
> Andy
>
> "Andy" <andy@work.com> wrote in message
> news:gbvl99$563$1@forums.macromedia.com...
>> Hi all
>>
>> I have a form that has four text fields that need joining together before
>> being entered into the database.
>>
>> Does anyone know how i can acheive this?
>> I'm using the DW command Behavior and the code below.
>> I've come up with the code directly below, but im not sure how to
>> impliment it.
>>
>> Thanks
>> Andy
>>
>> <% If Request("updateme") <>"" Then %>
>> <% Dim Cust_Ref
>> Cust_Ref = Request("cr1")&"/"& Request("cr2")&"/"& Request("cr3")&"/"&
>> Request("cr4") %>
>> <% end if
>> %>
>>
>>
>> <%
>> if(Request("Cust_ref") <> "") then Cal_Update__MMColParam11 =
>> Request("Cust_ref")
>> %>
>>
>> <%
>>
>> set Cal_Update = Server.CreateObject("ADODB.Command")
>> Cal_Update.ActiveConnection = MM_calcert_STRING
>> Cal_Update.CommandText = "UPDATE Calibrations SET Cust_Ref='" +
>> Replace(Cal_Update__MMColParam11, "'", "''") + "' WHERE Inst_ID = '" +
>> Replace(Cal_Update__MMColParam10, "'", "''") + "' "
>> Cal_Update.CommandType = 1
>> Cal_Update.CommandTimeout = 0
>> Cal_Update.Prepared = true
>> Cal_Update.Execute()
>> Response.Redirect("update_1.asp?InstID="&(RSCerts1.Fields.Item("Inst_ID").Value))
>> %>
>>
>
>


Inspiring
October 1, 2008
Forgot to mention that im using classic ASP - Access Database - DW 8
Thanks
Andy

"Andy" <andy@work.com> wrote in message
news:gbvl99$563$1@forums.macromedia.com...
> Hi all
>
> I have a form that has four text fields that need joining together before
> being entered into the database.
>
> Does anyone know how i can acheive this?
> I'm using the DW command Behavior and the code below.
> I've come up with the code directly below, but im not sure how to
> impliment it.
>
> Thanks
> Andy
>
> <% If Request("updateme") <>"" Then %>
> <% Dim Cust_Ref
> Cust_Ref = Request("cr1")&"/"& Request("cr2")&"/"& Request("cr3")&"/"&
> Request("cr4") %>
> <% end if
> %>
>
>
> <%
> if(Request("Cust_ref") <> "") then Cal_Update__MMColParam11 =
> Request("Cust_ref")
> %>
>
> <%
>
> set Cal_Update = Server.CreateObject("ADODB.Command")
> Cal_Update.ActiveConnection = MM_calcert_STRING
> Cal_Update.CommandText = "UPDATE Calibrations SET Cust_Ref='" +
> Replace(Cal_Update__MMColParam11, "'", "''") + "' WHERE Inst_ID = '" +
> Replace(Cal_Update__MMColParam10, "'", "''") + "' "
> Cal_Update.CommandType = 1
> Cal_Update.CommandTimeout = 0
> Cal_Update.Prepared = true
> Cal_Update.Execute()
> Response.Redirect("update_1.asp?InstID="&(RSCerts1.Fields.Item("Inst_ID").Value))
> %>
>