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
…