Forum Moderators: open
And here is my code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Option Explicit
Response.Expires = 0
%>
<%
<!--#include file="../../common/include/ADOVBS.INC" -->
Dim objConn, WebcastMail, strQuery, objRS
Dim UserId, FirstName, LastName, UserName, Password, FromDate, Users
Dim adOpenKeySet, adLockOptimistic, adCmdTable
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = Application("WebcastMail")
objConn.Open
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "UPDATE Users SET FirstName = '" & FirstName & "', " & "LastName = '" & LastName & "', " & "UserName = '" & UserName + "', " & "Password = '" & Password & "', " & "FromDate = #" & FromDate & "# ", objConn, adOpenKeySet, adLockOptimistic, adCmdTable
objRS.AddNew
UserId = Request.Form("UserID")
objRS("FirstName") = Request.Form("FirstName")
objRS("LastName") = Request.Form("LastName")
objRS("UserName") = Request.Form("UserName")
objRS("Password ")= Request.Form("Password")
objRS("FromDate") = Request.Form("FromDate")
objRS.Update
UserId = objRS("UserID")
objRS.Close()
objConn.Close()
%>
Can anyone help me? I really need this to work.
Thanks, Shuvi
Also, you don't need the concantenation for each of the field names:
objRS.Open "UPDATE Users SET FirstName = '" & FirstName & "', LastName = '" & LastName & "', UserName = '" & UserName + "', Password = '" & Password & "', FromDate = #" & FromDate & "# ", objConn, adOpenKeySet, adLockOptimistic, adCmdTable
And now that I'm error checking it give me the "No update permissions!" message.
Still no clue what I'm doing wrong.
Thanks for the help!
And here is my update statement:
strQuery = "UPDATE Users SET FirstName = '" & FirstName & "', " & "LastName = '" & LastName & "', " & "UserName = '" & UserName & "', " & "Password = '" & Password & "', " & "FromDate = '" & FromDate & "' "
strQuery = strQuery & "where UserID = " & UserId & ";"
When I print on the screen I get:
UPDATE Users SET FirstName = 'SHUVI', LastName = 'POWERS', UserName = 'SPOWERS', Password = 'SPOWERS', FromDate = '12/9/2003 7:55:52 AM' where UserID = 1;
I also tried putting # around the date parameter, and still got the same error.
Thoughts?
I'd really appreciate any help I could get.
I don't know Access syntax so I can't help there. Can you set up a simple table with just char or numeric data and see if you can update that from ASP? Or make the date column nullable and try your update without the date.
If you page is set-up in IIS as "Allow Anonymous" the I think the user hitting the database is IIS_USER, if that means anything.
Good Luck.