Converting app from Coldfusion to SQL Server 2005

  • I have a cold fusion application that post data

    to a website using the following code:

    <cfhttp url="http://www.test.com/test.php" method="Post">

    <cfhttpparam type="FORMFIELD" name="first_name" value="#form.name#">

    <cfhttpparam type="FORMFIELD" name="last_name" value="#form.lname#">

    <cfhttpparam type="FORMFIELD" name="address_1_street1" value="#form.address#">

    <cfhttpparam type="FORMFIELD" name="address_1_city" value="#form.city#">

    <cfhttpparam type="FORMFIELD" name="address_1_state" value="#form.state#">

    <cfhttpparam type="FORMFIELD" name="address_1_zip" value="#form.zip#">

    <cfhttpparam type="FORMFIELD" name="phone" value="#form.phone#">

    <cfhttpparam type="FORMFIELD" name="testd_1_currently_covered" value="#form.curr_testd#">

    <cfhttpparam type="FORMFIELD" name="testd_1_gender" value="#form.pgender#">

    <cfhttpparam type="FORMFIELD" name="testd_1_dobMM" value="#Month(form.page)#">

    <cfhttpparam type="FORMFIELD" name="testd_1_dobDD" value="#Day(form.page)#">

    <cfhttpparam type="FORMFIELD" name="testd_1_dobYYYY" value="#Year(form.page)#">

    <cfhttpparam type="FORMFIELD" name="testd_1_smoker" value="#form.ptobacco#">

    <cfhttpparam type="FORMFIELD" name="hgt_pi" value="#form.pht#">

    <cfhttpparam type="FORMFIELD" name="testd_1_heightFT" value="">

    <cfhttpparam type="FORMFIELD" name="testd_1_heightIN" value="">

    <cfhttpparam type="FORMFIELD" name="testd_1_smoker" value="#form.ptobacco#">

    <cfhttpparam type="FORMFIELD" name="testd_1_weight" value="#form.pwt#">

    </cfhttp>

    </cfoutput>

    I need to know the best way to add this code inside sql server 2005.

    I'd like to move this functionality from coldfusion to the sql server.

    Is this possible?  What features of SQL 2005 will I need to use in order

    to do this.

  • I don't know ColdFusion, but it seems to me that the code you showed runs as a web application, not inside a database. Thus you would be more likely to convert it to asp, or asp.net, and then involve SQL server if necessary.

    The equivalent construct in HTML is

    <form name="someformname" method="post" action="www.test.com/test.php">

    <input type="text" name="first_name" value="somevalue" />

    ....

    </form>

    The target page as shown is apparently in the PHP environment so perhaps your question is a PHP question, not a SQL Server question.

    Or am I missing something?

    Phil

     

  • Thanks Phil,

    The current application is written in Coldfusion.  I have been able to take most of the functionality and add it to stored procedures to be processed inside the server for instance one part of the app sends out emails.  Initially I was using cfmail in coldfusion to send out emails now I'm using database mail in sql server to do this.  This is the final peice of the app.  It post data to the web.  I need to find out how to do that from the server as well.  I'm thinking I can put sqlclr inside of a stored procedure to  do this but I'm not sure.  Any other thoughts?  If I can use sqlclr to add the appropriate asp.net code that you mentioned earlier that'd be great.

  • Whew! I think you're past my expertise (usually not tough to do!). I can't really see how you can take a web app and jam it into SQL server, which is not a web server. Nor can I understand why you would want to try.

    Am I missing something? Are you no longer intending to serve up web pages? If so, how does the app get invoked and where is the user interaction?

    Phil

  • The app is invoked by coldfusion however I am attempting to remove some of the functionality from the web server and add it to the sql server.  Like the email functionality.  Now I'm trying this with the http post functionality.  Any help would be appreciated.

  • Well, don't know how you can do that from inside SQL server, and I suspect that if you use the CLR to do it, it would be a real heavyweight way to go.

    That said, I would note that the code you posted appears to post to a target page, and the data it is posting may come from SQL server via ColdFusion (not sure what the #values are). If so, have a look at the target page and see whether it does anything useful. If it in turn just writes data back from the screen without the operator adding any valued input, then you might be able to put that update right in the stored proc you're working. Hope this makes some sense.

  • Perfect sense.  Thanks alot Phil.

  •  If it in turn just writes data back from the screen without the operator adding any valued input, then you might be able to put that update right in the stored proc you're working. Hope this makes some sense.

     

    Do you know how to do this?  This is what I think I need to do.

  • Well, I know how to do it in asp, and asp.net. I could take a crack at reading the ColdFusion code but I could easily make some bad assumptions.

    I think we need a ColdFusion guy to jump in here...

    But I can't follow what you're trying to do... take as much away from ColdFusion as possible but leave it running in ColdFusion? If you're abandoning ColdFusion, what are you replacing the web server with? IIS? ASP? I just don't follow....

     

  • Fortunately, I happen to be a Coldfusion guy.

    What Phil said is correct. The page is just posting form data to another website.

    I'm guessing that the form fields are being retrieved from Coldfusion as a single query row? You would still need to transmit those values to the website. You can use ASP, ASP.NET or PHP, but I don't think SQL Server can call another website with a form POST.

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply