This topic is locked

Before Record added - error - duplicate records

10/26/2012 12:02:58 PM
ASPRunnerPro General questions
N
Newbe author

Hi,
ASP 7.2
I am trying to add this in the Before Record Added

Master table: Registrations

ID - autonumber

ProjectID - text
'** Check if specific record exists ****

dim rsExists

set dal_table=dal.Table("Registrations")

set rsExists = dal.table.Query("ProjectID='" & values("ProjectID") & "'","")

if not rsExists.eof then

' if record exists do something

Flush_output

BeforeAdd=false

message = "This ProjectID (" & values("ProjectID") & ") is used already"

else

' if dont exist do something else

BeforeAdd=true

end if

rsExists.Close : set rsExists = Nothing
---------------------------------------------------------
If I use this code I get this error:

This error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying.

For more information about HTTP errors, see Help.


Is there a problem in my code: When I check the syntax = no errors.



If I simply erase this code - my application works perfectly

---------------------------------------------------------
this code used to work in version 6.2
I suspect the problem can be here???

set rsExists = dal.table.Query("ProjectID='" & values("ProjectID") & "'","")


The ASP manual suggests:
set rsExists = dal.table.Query("AnyColumn='" & values("AnyValue") & "'","")
Thanks

admin 10/26/2012

As a first step you need to configure your IIS to returned detailed error message to the browser. This is the article that can help:

http://www.iis.net/learn/application-frameworks/running-classic-asp-applications-on-iis-7-and-iis-8/classic-asp-script-error-messages-no-longer-shown-in-web-browser-by-default
Once you get to the actual error message post it here.

N
Newbe author 10/26/2012

Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment: 'dal.Table'
/Registrations_add.asp, line 0


thank you very much, here is the detailed error.

admin 10/26/2012

You need to syntax errors in your code. Check the proper way to call Query() function:

http://xlinesoft.com/asprunnerpro/docs/query.htm

N
Newbe author 10/29/2012

thank you very much, but I am using exactly same sytax adescribed in the manual.

admin 10/29/2012

This is not true. The dal.table.Query piece doesn't mean anything as you do not specify the table.