•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 391,558 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,692 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 1427 | Replies: 1
![]() |
•
•
Join Date: Apr 2006
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
I have a simple login screen where I want the user upon entering the correct userid/password , for his userid to be inserted into a table in a database so to keep track who visited his web page.
My ISP is supposedly has created a DS named "win5_zjconstructioninc_com"
but the code below is failing to insert a record to the database.
Can you experienced programmers be kind to take a look at the code below and suggest a course of action and that if I should take the issue up with my ISP.
Thanks in advance
J.
<%@ Language=VBScript %>
<%
Dim DB_CONNECTIONSTRING
DB_CONNECTIONSTRING = "Provider=SQLOLEDB;Data Source=sql.fastbighost.com;" _
& "Initial Catalog=win5_zjconstructioninc_com;UserId=win5_zjconstructioninc_com;Password=JFjwori8;" _
& "Connect Timeout=15;Network Library=dbmssocn;"
%>
<%
If request.form("login")="kal" and request.form("password")="walthers" then
session("userlogin") = "OK"
session("pass") = "OK"
Dim I
Dim iRecordToUpdate ' Id of deleted record
Dim strSQL ' String variable for building our query
Dim objRecordset
Set objRecordset = Server.CreateObject("ADODB.Recordset")
iRecordToUpdate = Request.QueryString("id")
iRecordToUpdate = Replace(iRecordToUpdate, "'", "''")
If IsNumeric(iRecordToUpdate) Then
iRecordToUpdate = CLng(iRecordToUpdate)
Else
iRecordToUpdate = 0
End If
strSQL = "SELECT * FROM userlogin WHERE id=" & iRecordToUpdate & ";"
objRecordset.Open strSQL, DB_CONNECTIONSTRING, adOpenKeyset, adLockPessimistic, adCmdText
If Not objRecordset.EOF Then
objRecordset.MoveFirst
objRecordset.Fields("text_field") = request.form("login")
objRecordset.Fields("integer_field") = CInt(Day(Now()))
objRecordset.Fields("date_time_field") = Now()
objRecordset.Update
End If
objRecordset.Close
Set objRecordset = Nothing
response.redirect "default2.asp"
End If
%>
<html>
<head>
<title>Mr. & Mrs. Kal Walther's Login Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../style.css" type="text/css">
</head>
<body text="#000000" bgcolor="#CED3D7" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="763" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" align="center">
<tr>
<td>
<table border="0" width="763" cellspacing="0" cellpadding="0" height="65" bgcolor="#E1E7EB">
</table>
</td>
</tr>
<tr>
<td align="center"><b><span class="headersmblue">California Dream <br><br>
Secure Login Area</span></b></td>
</tr>
<tr>
<td><br><br>
<table border="0" cellspacing="0" cellpadding="0" align="center" width="302">
<tr>
<td class="plaintext" width="302">
<form action="login.asp" method="post">
<table width="90%" border="0" cellspacing="3" cellpadding="0">
<tr>
<td colspan=2> </td>
</tr>
<tr>
<td class="plaintext">Login</td>
<td>
<input type="text" name="login">
</td>
</tr>
<tr>
<td class="plaintext">Password</td>
<td>
<input type="password" name="password">
</td>
</tr>
<tr>
<td colspan=2 align="center">
<input type="submit" name="Submit" value="Submit">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
My ISP is supposedly has created a DS named "win5_zjconstructioninc_com"
but the code below is failing to insert a record to the database.
Can you experienced programmers be kind to take a look at the code below and suggest a course of action and that if I should take the issue up with my ISP.
Thanks in advance
J.
<%@ Language=VBScript %>
<%
Dim DB_CONNECTIONSTRING
DB_CONNECTIONSTRING = "Provider=SQLOLEDB;Data Source=sql.fastbighost.com;" _
& "Initial Catalog=win5_zjconstructioninc_com;UserId=win5_zjconstructioninc_com;Password=JFjwori8;" _
& "Connect Timeout=15;Network Library=dbmssocn;"
%>
<%
If request.form("login")="kal" and request.form("password")="walthers" then
session("userlogin") = "OK"
session("pass") = "OK"
Dim I
Dim iRecordToUpdate ' Id of deleted record
Dim strSQL ' String variable for building our query
Dim objRecordset
Set objRecordset = Server.CreateObject("ADODB.Recordset")
iRecordToUpdate = Request.QueryString("id")
iRecordToUpdate = Replace(iRecordToUpdate, "'", "''")
If IsNumeric(iRecordToUpdate) Then
iRecordToUpdate = CLng(iRecordToUpdate)
Else
iRecordToUpdate = 0
End If
strSQL = "SELECT * FROM userlogin WHERE id=" & iRecordToUpdate & ";"
objRecordset.Open strSQL, DB_CONNECTIONSTRING, adOpenKeyset, adLockPessimistic, adCmdText
If Not objRecordset.EOF Then
objRecordset.MoveFirst
objRecordset.Fields("text_field") = request.form("login")
objRecordset.Fields("integer_field") = CInt(Day(Now()))
objRecordset.Fields("date_time_field") = Now()
objRecordset.Update
End If
objRecordset.Close
Set objRecordset = Nothing
response.redirect "default2.asp"
End If
%>
<html>
<head>
<title>Mr. & Mrs. Kal Walther's Login Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../style.css" type="text/css">
</head>
<body text="#000000" bgcolor="#CED3D7" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="763" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" align="center">
<tr>
<td>
<table border="0" width="763" cellspacing="0" cellpadding="0" height="65" bgcolor="#E1E7EB">
</table>
</td>
</tr>
<tr>
<td align="center"><b><span class="headersmblue">California Dream <br><br>
Secure Login Area</span></b></td>
</tr>
<tr>
<td><br><br>
<table border="0" cellspacing="0" cellpadding="0" align="center" width="302">
<tr>
<td class="plaintext" width="302">
<form action="login.asp" method="post">
<table width="90%" border="0" cellspacing="3" cellpadding="0">
<tr>
<td colspan=2> </td>
</tr>
<tr>
<td class="plaintext">Login</td>
<td>
<input type="text" name="login">
</td>
</tr>
<tr>
<td class="plaintext">Password</td>
<td>
<input type="password" name="password">
</td>
</tr>
<tr>
<td colspan=2 align="center">
<input type="submit" name="Submit" value="Submit">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
•
•
Join Date: May 2007
Location: http://sqltutorials.blogspot.com/
Posts: 20
Reputation:
Rep Power: 2
Solved Threads: 2
First, u didnt add in a form. you cant submit without a form.
Second, after u add in form, u need to add action="URL?login=kal&password=walthers"
If request.form("login")="kal" and
request.form("password")="walthers" then
i didnt check ur asp code, u try ist...
but i notice something wrong in ur asp code.
anywhere u try to add in form ist
Second, after u add in form, u need to add action="URL?login=kal&password=walthers"
If request.form("login")="kal" and
request.form("password")="walthers" then
i didnt check ur asp code, u try ist...
but i notice something wrong in ur asp code.
anywhere u try to add in form ist
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb ASP Marketplace
- SQL UPDATE Error (VB.NET)
- update problem... (ASP.NET)
- Finding the nth row (SQL)...debative question (Software Developers' Lounge)
- Best way to develop db for survey? (Database Design)
- Error with Update (MySQL)
- ADO.Net SQL UPDATE using OleDBAdapter (C#)
- How can i deledet and update from table ??????? (PHP)
Other Threads in the ASP Forum
- Previous Thread: Problem when adding delete confirmation
- Next Thread: why isn't this booking form working.


Linear Mode