This topic is locked
[SOLVED]

 DB tries to update certain read-only expressions

9/27/2006 10:20:49 AM
ASPRunnerPro General questions
B
berkeleyjw author

I am attempting to create a dynamic url link in the "Edit SQL Manually" area to create a calculated field called url_link_ro. I set this field to be read-only and only visivle on thelist and edit pages. However, whevever I attempt to save any changes from the Edit screen, SQL Server returns an error that says url_link is an "invalid column" - even though I specifically set this field as read-only in the ASPRunner setup screens.
I did some experimenting and discovered the following:
If the read-only field simply duplicates an already-existing field in the table, I AM able to successfully create a read-only field:
select [tscrpt1_pk],

[person_pk],

[acad_car_pk],

[group_pk],

person_pk as [person_pk_ro]

From [dbo].[SRM_RC_TRANSCRIPT1]
In that case, the field person_pk_ro is set up as a read-only field. It works fine. I am able to save a record and it doesn't try to update the non-existend person_pk_ro field.
But, if I use the following SQL instead, I get an error when trying to save the record:
select [tscrpt1_pk],

[person_pk],

[acad_car_pk],

[group_pk],

'X' as [person_pk_ro]

From [dbo].[SRM_RC_TRANSCRIPT1]
In this case, person_pk_ro is assigned another value that is not the same as a database field value. If I use this SQL, the "X" field properly appears as a read-only value, but the database wil actually try to save to the non-existent field person_pk_ro, causing an error.
Here is what I need to do:
select [tscrpt1_pk],

[person_pk],

[acad_car_pk],

[group_pk],

'DBC_TRANSCRIPT1.asp?tscrpt1_pk=' + cast(tscrpt1_pk as varchar) as [url_link_ro]

From [dbo].[SRM_RC_TRANSCRIPT1]
Does anyone know a workaround for this? The only other alternative I can think of is to actually store the URL in the database table, which seems like a waste of space.

Sergey Kornilov admin 9/27/2006

Jim,
I guess you can simply remove this calculated field from Add/Edit pages.

You can do this on Choose fields step in ASPRunnerPro.

B
berkeleyjw author 9/28/2006

Sergey,
The error still occurs even when I remove the calculated hyperlink field from the Edit page (and just leave it on the list page).
Furthermore, modifying the SQL to create a calculated hyperlink field was given as a solution by Jane for another user:

http://www.asprunner.com/forums/index.php?...23&hl=hyperlink
So, I am not trying to do anything that should not work. I am trying to do something very similar to what Jane describes.
Please advise.

J
Jane 9/28/2006

Jim,
please post the full error message here.
Also I recommend you to check your query in the database directly.

B
berkeleyjw author 9/28/2006

Jane,
The query runs against the database with no problems.
select [tscrpt1_pk],

[person_pk],

[acad_car_pk],

[group_pk],

'DBC_TRANSCRIPT1.asp?tscrpt1_pk=' + cast(tscrpt1_pk as varchar) as [url_link_ro]

From [dbo].[SRM_RC_TRANSCRIPT1]
Results:
1 410 2 NULL DBC_TRANSCRIPT1.asp?tscrpt1_pk=1

2 1 2 NULL DBC_TRANSCRIPT1.asp?tscrpt1_pk=2

15 -1 -1 8 DBC_TRANSCRIPT1.asp?tscrpt1_pk=15
I am using Microsoft SQL Server.
Even though I do not have the calculated field "url_link_ro" on the edit page, I get this error when I attempt to save an edited record:
Error Type:

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)

[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'url_link_ro'.

/ASPRunnerPro/SRM_RC_TRANSCRIPT1_edit.asp, line 285

J
Jane 9/28/2006

Jim,
you can't use calculated fields on the EDIT and ADD pages.

Remove this field from the EDIT/ADD page and rebuild your pages.

B
berkeleyjw author 9/28/2006

Jane,
I do not have the calculated field on either the add or the edit page. I still get the error.

Sergey Kornilov admin 9/28/2006

Jim,
please send me your ASP files along with script that creates tables in SQL Server.

B
berkeleyjw author 9/29/2006

Sergey, I mailed you my project and my SQL database create script yesterday. Please let me know when you get a chance to look it over. Thanks.

Sergey Kornilov admin 9/30/2006

Jim,
replied to your email.

B
berkeleyjw author 10/2/2006

Sergey,
I did not receive your reply. Please try sending again. Maybe our SPAM filter got it? Thanks.

Sergey Kornilov admin 10/3/2006

Jim,
sent it one more time.