 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

May 15th, 2004, 12:42 PM
|
|
Authorized User
|
|
Join Date: May 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok, no matter what it uses the third SQLStatement.
Thank you,
Jon Turlington
|
|

May 16th, 2004, 04:48 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Right, well, that seems to indicate that both of your fields are not empty when you submit them to this page.
How does the code for the input boxes look like? Maybe there is some additional whitespace like a space or tab character in there somewhere??
Cheers,
Imar
|
|

May 16th, 2004, 10:55 PM
|
|
Authorized User
|
|
Join Date: May 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Well, I seem to have all that stuff taken care of through some good ole hard work
Yet, I have a new question I don't seem to be able to find an answer for.
Can you use .HasKeys in other things besides cookies?
Thanks Imar..
Thank you,
Jon Turlington
|
|

May 17th, 2004, 01:50 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
If you're talking about "classic ASP", I don't think so. AFAIK, only a Cookie can contain sub values. You use .HasKeys to see if a cookie has any of these sub values.
Why? What are you trying to do?
And what was the problem you fixed to get the right SQL statement running??
Imar
|
|

May 17th, 2004, 10:48 AM
|
|
Authorized User
|
|
Join Date: May 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
What I was trying to do was setup a script for the ISP I work for to check the persons IP then say hello based on the name related to the IP in our database. The code for that right now looks like.
Code:
<% userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If userip = "" Then
userip = Request.ServerVariables("REMOTE_ADDR")
End if
set platConn = Server.CreateObject("ADODB.Connection")
platConn.open "dsn","sa","password"
set platUser=Server.CreateObject("ADODB.recordset")
platUser.ActiveConnection = platConn
platUser.Source = "SELECT username FROM CallsOnline WHERE FramedAddress='" & userip & "' ORDER BY CallDate DESC"
platUser.Open()
If Not platUser.EOF Then
set platName=Server.CreateObject("ADODB.recordset")
platName.ActiveConnection = platConn
platName.Source ="SELECT name from customer where username='" & platUser.Fields("username").Value & "'"
platName.Open()
xerror="no"
else
xerror = "yes"
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>IP Test</title>
</head>
<body>
<% If Not xerror="yes" Then
response.Write("Welcome, " & platName.Fields("name").Value)
Else
response.Write("Welcome")
End If
%>
</body>
</html>
<% If Not xerror="yes" Then
platUser.close()
platName.close()
platConn.close()
Else
platUser.close()
platConn.close()
End If %>
As far as the code goes that worked it was.
Code:
<%
Dim SQLStatement
Dim Username
Dim Password
Password = Request.Form("password")
UserName = Request.Form("username")
' Both fields empty?
If Password = "" and UserName = "" Then Response.Redirect("../administration/error.asp?errorid=noidorpass")
' Update just the username
If Password = "" and UserName <> "" Then
SQLStatement = "UPDATE auth SET username='" & UserName & "' WHERE id ='" & Request.Form("id") & "'"
End If
' Update just the password
If Password <> "" and UserName = "" Then
SQLStatement = "UPDATE auth SET password='" & Password & "' WHERE id ='" & Request.Form("id") & "'"
End If
' Update both
If Password <> "" and UserName <> "" Then
SQLStatement = "UPDATE auth SET username='" & UserName & "', password='" & Password & "' WHERE id ='" & request.form("id") & "'"
End If
' Comment out the next two lines when SQLStatement looks OK
' Response.Write("ID = " & Request.Form("id") & " Username = " & Username & " Password = " & Password & "<br>")
' Response.Write("SQL is " & SQLStatement)
' Response.End
' If there is something to execute
If Len(SQLStatement) > 0 Then
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "tur","sa","*******"
oConn.Execute(SQLStatement)
oConn.Close
Set oConn = nothing
End If
Response.Redirect("display_users.asp?status=complete&xuser=" & UserName)
%>
Thank you,
Jon Turlington
|
|

May 17th, 2004, 02:59 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hmmm, not sure if you are just describing how it is currently working, or if you're asking another question.
Is everything working as it should??
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

May 17th, 2004, 03:37 PM
|
|
Authorized User
|
|
Join Date: May 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
It's all working GREAT! really appreciate all the help.
I will be talking my company into purchasing me a new library of resources could you recommend some of your books and other that could help me with developing ASP using VB and SQL. I do use dreamweaver as much as possible also.
Thank you,
Jon Turlington
|
|

May 18th, 2004, 01:59 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Jon,
If you're working with Dreamweaver, I should recommend Beginning Dreamweaver MX 2004, of course: http://www.wrox.com/books/0764555243.shtml ;)
The book deals with the things you're working on right now in great detail: accessing databases, creating master-detail pages, creating delete pages, securing your site, building a completely database-drive site etc etc etc.
Other good books are "Beginning Active Server Pages ( http://www.wrox.com/books/0764555243.shtml)", ASP Programmer's Reference (ex-Wrox) or Beginning ASP Databases (ex-Wrox as well).
Most books on the current Wrox list focus on ASP.NET rather than ASP, so I think you should look at Amazon to find the books that other people like as well.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
 |