I am getting the following error:
Error Type:
ADODB.Command (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/dcme/newframe/verify.asp, line 48
Line 48 is:
cmd.Parameters. Append cmd.CreateParam eter("UN", adVarChar, adParamInput, 10)
My table is set to text and 10 char
My code is here: -
<%
-
'Connection String
-
Dim Conn
-
'Query to be executed
-
Dim SQLQuery
-
'Recordset
-
Dim rs
-
'UN Of Logged in user
-
Dim UserName
-
'PW of User
-
Dim Password
-
-
'Getting information from submitted form
-
UserName = UCase(request.form("username"))
-
Password = UCase(request.form("password"))
-
RememberMe = request.form("rememberme")
-
NewPassword = request.form("newpassword")
-
NewUser = request.form("newuser")
-
SessionID=Session.SessionID
-
-
'Creating connection Object
-
set Conn=server.createobject("ADODB.Connection")
-
Conn.Mode = 3
-
'Creating Recordset Object
-
'set rs = Server.CreateObject("ADODB.Recordset")
-
'Initialising Provider String
-
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source="
-
connStr = connStr + server.MapPath("db/frame.mdb")
-
-
'Opening Connection to Database
-
Conn.open connStr
-
-
'If not blank Username password submitted
-
if UserName <> "" or Password <> "" then
-
-
'Recordset and Query to be executed
-
rs = "select * from [user] where UN = '"&UserName&"' AND PW = '"&Password&"'"
-
-
'Retrieving recordset by executing SQL
-
'set rs=Conn.execute(SQLQuery)
-
-
'If New User selected
-
if NewUser = "ON" then
-
'Create Entry
-
Set cmd = Server.CreateObject("ADODB.Command")
-
Set cmd.ActiveConnection = Conn
-
cmd.CommandText = "insert into [user] (UN, PW, ssid) values (?, ?, ?)"
-
cmd.Parameters.Append cmd.CreateParameter("UN", adVarChar, adParamInput, 10)
-
cmd.Parameters.Append cmd.CreateParameter("PW", adVarChar, adParamInput, 10)
-
cmd.Parameters.Append cmd.CreateParameter("ssid", adVarChar, adParamInput, 50)
-
cmd.Parameters("UN") = UserName
-
cmd.Parameters("PW") = Password
-
cmd.Parameters("ssid") = SessionID
-
cmd.Execute
-
else
-
end if
-
-
'If New Password selected
-
if NewPassword = "ON" then
-
'Update Password
-
Set cmd = Server.CreateObject("ADODB.Command")
-
Set cmd.ActiveConnection = Conn
-
cmd.CommandText = "UPDATE user SET PW="& Password &" WHERE UN="+ UserName +""
-
cmd.Execute
-
else
-
end if
-
-
'If remember me selected
-
if RememberMe = "ON" then
-
'Writing cookies permanently
-
Response.Cookies("UserName")=UserName
-
Response.Cookies("Password")=Password
-
Response.Cookies("UserName").Expires = Now() + 365
-
Response.Cookies("Password").Expires = Now() + 365
-
Response.Redirect "basicinfo.asp"
-
else
-
'writing cookies temporarily
-
Response.Cookies("UserName")=UserName
-
Response.Cookies("Password")=Password
-
Response.Redirect "basicinfo.asp"
-
end if
-
-
'If no records retrieved
-
if rs.BOF and rs.EOF then
-
Response.Redirect "Signon.asp?username=" & UserName
-
else
-
'Closing all database connections
-
Conn.Close
-
rs.close
-
set rs = nothing
-
set Conn = nothing
-
end if
-
else
-
'Invalid User
-
Response.Redirect "Signon.asp?UserName=blank"
-
end if
-
%>
2 1874 jhardman 3,406
Recognized Expert Specialist
Check out the method in the "How-to" section, I think it runs a bit smoother.
Jared
CroCrew 564
Recognized Expert Contributor
Hello bmallett,
You might want to take another look at how your code is set to run and also your database. Table names should not use reserved names within your database. Here is a stab at cleaning/thinning out your code. Please be advised I tried to keep inline with what your were trying to do so even my code is not truly optimized. PM me if you want to talk more in person.
Hope this helps~ -
<%
-
xUserName = replace(request.form("UserName"),"'","''") '<-- User's Name.
-
xPassword = replace(request.form("Password"),"'","''") '<-- User's current password.
-
xNewPassword = replace(request.form("NewPassword"),"'","''") '<-- New password to be saved if ChangePassword value is true.
-
xNewUser = request.form("NewUser") '<-- Make this a boolean (true or false) value.
-
xChangePassword = request.form("ChangePassword") '<-- Make this a boolean (true or false) value.
-
xRememberMe = request.form("RememberMe") '<-- Make this a boolean (true or false) value.
-
xSessionID = Session.SessionID
-
-
Set adoCon = Server.CreateObject("ADODB.Connection")
-
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db/frame.mdb")
-
Set rsUpdate = Server.CreateObject("ADODB.Recordset")
-
-
If (xNewUser) Then
-
strSQL = "SELECT TOP 1 * FROM [user]"
-
rsUpdate.CursorType = 2
-
rsUpdate.LockType = 3
-
rsUpdate.Open strSQL, adoCon
-
rsUpdate.AddNew
-
rsUpdate.Fields("UN").Value = xUserName
-
rsUpdate.Fields("PW").Value = xPassword
-
rsUpdate.Fields("ssid").Value = xSessionID
-
rsUpdate.Update
-
Response.Write("New user has been added.<br>")
-
Else
-
strSQL = "SELECT * FROM [user] WHERE UN = '" & xUserName & "' AND PW = '" & xPassword & "'"
-
rsUpdate.CursorType = 2
-
rsUpdate.LockType = 3
-
rsUpdate.Open strSQL, adoCon
-
If ((rsUpdate.EOF) OR (((StrComp(xPassword, rsUpdate("PW").value) = 0)) Then
-
Response.Write("The combination of UserName and Current Password is bad!")
-
Response.end
-
End If
-
If (NewPassword) Then
-
rsUpdate.Fields("PW") = xNewPassword
-
rsUpdate.Update
-
Response.Write("Password has been changed.<br>")
-
End If
-
End If
-
-
Response.Write("You are currently login in.")
-
-
If (xRememberMe) Then
-
Response.Cookies("LocalUser")("CookieTest") = "true"
-
If Request.Cookies("LocalUser")("CookieTest") Then
-
Response.Cookies("LocalUser")("UserName") = xUserName
-
Response.Cookies("LocalUser")("Password") = xPassword
-
Response.Cookies("LocalUser").Expires = (Now() + 365)
-
Else
-
Response.Write("But, you will not be remembered because your cookies are disabled.")
-
End If
-
End If
-
%>
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Gerry |
last post by:
As I'm not a PHP-prgrammer at all, I just need Help with this: I have
had a guestbook-page in Europe and will
now have to move it to a US based-server. This makes the
time-function showing time 6 hours wrong. The time should be GMT minus
6 hours. Can anyone help me with that? Her's the code:
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
|
by: serge |
last post by:
Using some VB sample code on the Internet I have the following
that works well and exports a set of records to an XML file:
Dim oCmd, sSQL, oDom
Set oDom = CreateObject("Msxml2.DOMDocument.4.0")
Set oCmd = CreateObject("ADODB.Command")
oCmd.ActiveConnection = "Provider=SQLOLEDB;Data Source=(local);Initial
Catalog=TestXML;UID=sa;Password=123456"
|
by: Eirik Eldorsen |
last post by:
I'm tring to translate an VB.NET method into C#. Here is what I've done so
far. Need help on the while loop
public static void SetInitialFocus(Control ctrl)
{
StringBuilder s = new StringBuilder();
s.Append("<SCRIPT LANGUAGE='JavaScript'>");
s.Append("function SetInitialFocus()");
s.Append("{");
s.Append(" document.");
|
by: Piper707 |
last post by:
I need help with using a general template which would process all tags
other than the ones for which specific templates have been written.
My XML looks like this:
<ITEMS>
<SPECIAL1>abc</SPECIAL1>
<SPECIAL2>abc</SPECIAL2>
...
<SPECIAL12>abc</SPECIAL9>
|
by: pramodrepaka |
last post by:
i am not able to add records with the help of ADODB. what is the problem i am not able to understand please help me. this is the code i written
In General Declaration
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub Form_Load()
Set rs = New ADODB.Recordset
| |
by: njsimha |
last post by:
Hi,
In the folowing XML snippet:
<template1>
<name>student</name>
<elem1>
<subelem1>65</subelem1>
<subelem2>15</subelem2>
</elem1>
|
by: njsimha |
last post by:
Hi,
I have the following XML snippet:
<root>
<template1>
<elem1>1000</elem1>
<elem2>
<subelem1>65</subelem1>
|
by: njsimha |
last post by:
Hi,
I have a query regarding the selection of a particular tag based on a condition.
In the following XML code:
<root>
<template1>
<elem1>1000</elem1>
<elem2>
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |