Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 3:44 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Posting Web Data with ASP
PostPosted: September 30th, 2007, 1:04 am 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi

I am working on 2 quizzes that need a few quiz-taker details and the 2 quiz scores (saved in variables: firstname, lastname, email, age, gender, score1 and score2) posted as web data. With help, I was beginning to set up a PHP script for the server-side and post web actions to an sql db, when the web site's ISP informed that PHP is not allowed on the Windows server they host: it will only accept ASP 2 to post to the sql db on the server that I have set up.

I'm afraid I have little enough experince using the post web action, and no experience writing ASP to handle the data on the server. I have some tutorials for the server side sql set-up from the ISP, but they don't go into ASP scripting. I would be grateful if someone can point me toward some leads to script the basic ASP for this posting of data for these 7 variables? A sample script that I could adapt would also be very helpful. :)

Kind Regards,

_________________
Stephen


Top
 Profile  
 
 Post subject:
PostPosted: October 2nd, 2007, 9:41 am 
Offline

Joined: January 10th, 2005, 11:08 am
Posts: 63
Location: Birmingham, United Kingdom
Opus: All between ver Pro XE 4.5 and Ver 9.62
OS: Windows XP Pro SP3
System: Intel Core2 Duo 2.67Ghz, Matrox Millennium G550 dual head graphics card
Dear Stephen,
Our programmers wrote this for storing our data on one of our servers, I have replaced the variables with those given in your text. It is written for an SQL database so you may have to change the 'Provider' line for MS Access. You will also have top fill in the areas that I have marked with ??? to match the database access user Id, password etc and finally the location of your data source. The line LASTNAME=Replace(LASTNAME,"'","''") is included to deal with hyphenated last names.
Here is the code:
Code:
<%@ Language=VBScript %>
<%

Option Explicit

Dim cnn
Dim rst
Dim sql
Dim FIRSTNAME, LASTNAME, EMAIL, AGE, GENDER, SCORE1, SCORE2

FIRSTNAME = Request("FIRSTNAME")
LASTNAME = Request("LASTNAME")
EMAIL = Request("EMAIL")
AGE = Request("AGE")
GENDER = Request("GENDER")
SCORE1 = Request("SCORE1")
SCORE2 = Request("SCORE2")

set cnn = Server.CreateObject("ADODB.Connection")
set rst = server.CreateObject("ADODB.Recordset")

cnn.open "Provider=SQLOLEDB.1;User ID=????;Password=????;Persist Security Info=True;Initial Catalog=????;Data Source=????"

LASTNAME=Replace(LASTNAME,"'","''")

sql = "insert into DatabaseName (FIRSTNAME, LASTNAME, EMAIL, AGE, GENDER, SCORE1, SCORE2) values ('" & FIRSTNAME & "','" & LASTNAME & "','" & EMAIL & "','" & AGE & "','" & GENDER & "','" & SCORE1 & "','" & SCORE2 & "')"
set rst = cnn.Execute (sql)

rst.Close
cnn.Close

set cnn = nothing
set rst = nothing

%>


Hope this is helpful,

_________________
Andy Thompson
Opus Pro XE 4.5, Pro 5.5, Ver 6, Ver 7, Ver 8.6, Ver 9.62
Windows XP Pro on an Intel Core2 Duo 2.67Ghz with a Matrox Millennium G550 LP PCIe dual-head card.


Top
 Profile Visit website  
 
 Post subject:
PostPosted: October 2nd, 2007, 11:38 am 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Thanks, Andrew.

I'll give it a try. :)

Kind Regards,

Stephen

_________________
Stephen


Top
 Profile  
 
 Post subject:
PostPosted: October 11th, 2007, 3:07 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Andrew

Do you, by any chance, have the 'query/read from' script for this SQL DB connection? If so, I would be grateful if you could post it to share. If I can get this working, I will need to both insert data and read back from the DB.

Thanks.

Kind Regards,

_________________
Stephen


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 38 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group