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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use response.write ("eval....") with sql record

Status
Not open for further replies.

tabbytab

Technical User
Mar 21, 2005
74
0
0
GB
Hi Guys,
I hope this is the right place to raise this as it partly involves SQL.

I have stored in a text field in a SQL database several sentances that I want to personalise with a person first name.

Example of db record

What do you want varfirstname to stop?

I want it to display substituting varfirstname with an actual name that i have available as a variable on the page.

My questions are simply this.

Can i use

Response.Write ("<td>sometext" &eval(fieldname)&" some more text")

If so how do I store ( in SQL) the record with quotes etc to allow phrase to be evaluated and pick up and insert variable varfirstname.

When i read the above it seems as clear as mud - I hope you get the jist...

Thanks in advance

TabbyTab:)

 
I believe I understand what you want to do and yes, it should be possible. Indeed, I think it should not be at all difficult. You already have the right idea.
Code:
dim varFirstName
varFirstName = request.form("UserFirstName")
response.write "<td>Hey, " & varFirstName & ", what would you like to do today?</td>"
[COLOR=green]'Or, if you are using database values, you could also do this[/color]
response.write "<td>" & varFirstName & ", " & rs.fields("FirstSentence") & "</td>"

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Why store the quotes in the database?

You could just use
Code:
dim strName 
strName = request.form("FirstName")
response.write (replace(rs.fields("Sentence"),"varFirstName", strName)
 
Ok, now that I read maharoff's response, I think I misread the question originally. But his response should be right-on and should give you what you need. Sorry for any confusion on my part.

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top