Groups | Blog | Home
all groups > inetserver asp db > july 2005 >

inetserver asp db : field


Joe
7/26/2005 2:57:01 PM
Hi,

I have a “Yes/No” data field in MS Access database that I am trying to
update. Here is my update statement,
strSQL = "UPDATE dndusers SET Active = Yes WHERE E_Mail='" &
Request.QueryString("email") & "' AND Activation_Code = " & fRandomPassword &
";"

I get an error message saying "No value given for one or more required
parameters" and points to “.Execute” line.

Here is my code.

I have never worked with “Yes/No” data field before and when I print the
strSQL, I see all the variables have values. Can someone tell me why I am
getting this error?

Thanks for your time.

Joe

Dim objConn
Dim objRS
Dim bUserExist

bUserExist = FALSE

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=E:\test\databases\test.mdb;"

Set objRS=Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM dndusers " & "WHERE E_Mail='" &
Request.QueryString("email") & "' AND Activation_Code = '" &
Request.QueryString("activatecode") & "';"
objRS.Open strSQL, objConn, adOpenForwardOnly, adLockReadOnly, adCmdText

If Not objRS.EOF And Not objRS.BOF Then
bUserExist = TRUE
strSQL = "UPDATE dndusers SET Active = Yes WHERE E_Mail='" &
Request.QueryString("email") & "' AND Activation_Code = " & fRandomPassword &
";"
Set updateCmd = Server.CreateObject("ADODB.Command")
With updateCmd
.ActiveConnection = objConn
.CommandText = strSQL
.Execute
End With
objRS.Close()
Joe
7/27/2005 9:43:04 AM
Even 1 and 0 doesn't work, I get following error,

Microsoft JET Database Engine error '80040e10'

No value given for one or more required parameters.

/customerportal2/dnd/activate.asp, line 61

The line 61 is '.Execute'.

With updateCmd
.ActiveConnection = objConn
.CommandText = strSQL
.Execute
End With


This is not realted to write permission beacsue I can insert record in this
database witout any problem.

The SQL statement is,

UPDATE dndusers SET Active = 1 WHERE E_Mail='test2005@canada.com' AND
Activation_Code = lnuqxynzoe;






[quoted text, click to view]
CJM
7/27/2005 10:04:12 AM

[quoted text, click to view]

What SQL does this produce?

Joe
7/27/2005 10:11:02 AM
I tried both

UPDATE dndusers SET Active = 1 WHERE E_Mail='test2005@canada.com' AND
Activation_Code = 'lnuqxynzoe';

and

UPDATE dndusers SET Active = 1 WHERE E_Mail='test2005@canada.com' AND
Activation_Code = lnuqxynzoe;





[quoted text, click to view]
Ray Costanzo [MVP]
7/27/2005 10:48:14 AM
Don't use "yes." That word means nothing. Use true or false, or 1 or 0
(preferred).

strSQL = "UPDATE dndusers SET Active = 1 WHERE ...."

Ray at work

[quoted text, click to view]

Joe
7/27/2005 11:19:05 AM
Tried that as well. Then I don't get any error, but when I open the access
DB, I don't see any updated doen in Active field.

UPDATE dndusers SET Active = 1 WHERE E_Mail='test2005@canada.com' AND
Activation_Code = 'lnuqxynzoe';

Joe



[quoted text, click to view]
Joe
7/27/2005 11:36:12 AM
Yes I do have matching record. For some reason with Activation_code
delimited in ', I don't get any error but Active field realted to this WHERE
clause doesn't change. By default Active is not seclected in DB meaning it is
empty. I want to set it to Yes.

Joe



[quoted text, click to view]
Ray Costanzo [MVP]
7/27/2005 2:09:21 PM
Your Activation_Code value needs to be delimited in ' as well.

Ray at work

[quoted text, click to view]

Ray Costanzo [MVP]
7/27/2005 2:22:42 PM
So, do you have any records that meet that WHERE clause?

SELECT * from dndusers WHERE E_Mail='test2005@canada.com' AND
Activation_Code = 'lnuqxynzoe'

Ray at work


Does that return anything? If not, that would tell you why nothing
[quoted text, click to view]

Ray Costanzo [MVP]
7/27/2005 8:33:43 PM
Please post your new and updated code that you're using now.

Ray at home

[quoted text, click to view]
dave
8/30/2005 12:00:00 AM
Try

UPDATE dndusers SET [Active] = 1 WHERE E_Mail='test2005@canada.com' AND
Activation_Code = 'lnuqxynzoe'

rgds
dave

[quoted text, click to view]

Bob Barrows [MVP]
8/30/2005 12:47:00 AM
Two problems with this:
1. It's a month late ;-)
2. Unless Active is a Number field, 0 or -1 would be more appropriate
alternatives for its value.

[quoted text, click to view]

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

AddThis Social Bookmark Button