This topic is locked
[SOLVED]

  Edit not working when using search to display records

10/15/2012 8:34:18 AM
ASPRunnerPro General questions
G
gdmacdo author

I a table, ODR_v2, and a SQL view, StuSchool, and they are inner joined by StudentID to ENRKSTDT. This is so the Student's demographic data is displayed.
I have the search panel on the ODR_v2_list.asp page showing:
StudentID

ENRLAST (the student's last name from the StuSchool View)
When enter the student id in the search panel and click search, it displays the record and when I click on the edit link, it opens the edit page for that record.
When I enter the student's last name in the ENRLAST field, it properly displays the record, but when I click on the edit link, it returns an error 500. I have chosen friendly messages and it only shows the 500 error. There are no StuSchool fields on the edit page.
Hovering over the edit link, the link address is to the exact same url.
It seems that it will only perform the edit function if I search on a field that is included in the actual ODR_v2 table and not part of the view. It is odd that it properly performs the search. Here are the urls:
Page URL Searching using StudentID #:

http://esems03/odr/ODR_v2_list.asp?a=integrated&ctlSearchFor=&simpleSrchFieldsComboOpt=&simpleSrchTypeComboNot=&simpleSrchTypeComboOpt=&criteria=and&type1=&value11=999900&field1=StudentID&option1=Contains&not1=
Edit link for above search:

http://esems03/odr/ODR_v2_edit.asp?editid1=2315'>http://esems03/odr/ODR_v2_edit.asp?editid1=2315
Page URL searching using ENRLAST:

http://esems03/odr/ODR_v2_list.asp?a=integrated&ctlSearchFor=&simpleSrchFieldsComboOpt=&simpleSrchTypeComboNot=&simpleSrchTypeComboOpt=&criteria=and&type1=&value11=sponge&field1=ENRLAST&option1=Contains&not1=
Edit link for above search:

http://esems03/odr/ODR_v2_edit.asp?editid1=2315'>http://esems03/odr/ODR_v2_edit.asp?editid1=2315
I have reset the list page, I have cleared out all search fields and put them back in again, and put the default field names in the Label Editor.
Any ideas why the edit link will not function?

admin 10/15/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.

G
gdmacdo author 10/16/2012

Thank you. The error returned is:
Microsoft SQL Server Native Client 10.0 error '80040e31'
Query timeout expired
/odr/include/aspfunctions.asp, line 1243
The section in aspfunctions.asp is:
function db_query(sSQL,conn)

dim asp_rs

if IsIdentical(dDebug,true) then response.write sSQL & "
"

Set asp_rs = server.CreateObject("ADODB.Recordset")

asp_rs.Open sSQL,conn Line 1243

call ReportError

set db_query=asp_rs

end function



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.

admin 10/16/2012

It looks like your query takes long time to execute causing SQL Server timeout. Here is the article that explains how to print all executed queries on the web page:

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

G
gdmacdo author 10/17/2012

First, the debug option is awesome. It will help me fix some Active Directory issues. This is what I receive on the time out:
select GroupID from [dbo].[odr71_uggroups] where Label in ('ESE.CO.Admin','ESE Staff.ESE.CO.Admin','Dist.ESE.CO.Admin','Dist.Departments.CO.Admin','Domain Users','macg')

select TableName,AccessMask from [dbo].[odr71_ugrights] where GroupID in (1)

SELECT [dbo].[ODR_v2].[StudentID], [dbo].[ODR_v2].[Incident_Date], [dbo].[ODR_v2].[ID], [dbo].[ODR_v2].[Incident_Time], [dbo].[ODR_v2].[Describe_Behavior], [dbo].[ODR_v2].[Parent_Contact], [dbo].[ODR_v2].[Parent_Contact_Date], [dbo].[ODR_v2].[Parent_Contact_Detail], [dbo].[ODR_v2].[Action_Recommended], [dbo].[ODR_v2].[Incident_Location], [dbo].[ODR_v2].[Possible_Motivation], [dbo].[ODR_v2].[Persons_offending], [dbo].[ODR_v2].[Num_of_Offenders], [dbo].[ODR_v2].[Teacher_Email], [dbo].[ODR_v2].[Admin_Email], [dbo].[ODR_v2].[Consequence_Date], [dbo].[ODR_v2].[Consequence_Date_Thru], [dbo].[ODR_v2].[Num_Days], [dbo].[ODR_v2].[Parent_Phone], [dbo].[ODR_v2].[Parent_Contact_Date_Admin], [dbo].[ODR_v2].[Parent_Contact_Time], [dbo].[ODR_v2].[Parent_Contact_Type], [dbo].[ODR_v2].[Admin_Comments], [dbo].[StuSchool].[ENRLAST], [dbo].[StuSchool].[ENRFRST], [dbo].[StuSchool].[GR], [dbo].[StuSchool].[ETH], [dbo].[StuSchool].[PRIMEXCP], [dbo].[StuSchool].[DOB], [dbo].[StuSchool].[PMSCHL], [dbo].[ODR_v2].[Hours], [dbo].[ODR_v2].[GroupID4], [dbo].[StuSchool].[SCHL], [dbo].[ODR_v2].[TERMS_Empl] FROM dbo.ODR_v2 INNER JOIN dbo.StuSchool ON dbo.ODR_v2.StudentID = dbo.StuSchool.ENRKSTDT where dbo.ODR_v2.ID=2315

SELECT top 1 [dbo].[ODR_v2].[StudentID], [dbo].[ODR_v2].[Incident_Date], [dbo].[ODR_v2].[ID], [dbo].[ODR_v2].[Incident_Time], [dbo].[ODR_v2].[Describe_Behavior], [dbo].[ODR_v2].[Parent_Contact], [dbo].[ODR_v2].[Parent_Contact_Date], [dbo].[ODR_v2].[Parent_Contact_Detail], [dbo].[ODR_v2].[Action_Recommended], [dbo].[ODR_v2].[Incident_Location], [dbo].[ODR_v2].[Possible_Motivation], [dbo].[ODR_v2].[Persons_offending], [dbo].[ODR_v2].[Num_of_Offenders], [dbo].[ODR_v2].[Teacher_Email], [dbo].[ODR_v2].[Admin_Email], [dbo].[ODR_v2].[Consequence_Date], [dbo].[ODR_v2].[Consequence_Date_Thru], [dbo].[ODR_v2].[Num_Days], [dbo].[ODR_v2].[Parent_Phone], [dbo].[ODR_v2].[Parent_Contact_Date_Admin], [dbo].[ODR_v2].[Parent_Contact_Time], [dbo].[ODR_v2].[Parent_Contact_Type], [dbo].[ODR_v2].[Admin_Comments], [dbo].[StuSchool].[ENRLAST], [dbo].[StuSchool].[ENRFRST], [dbo].[StuSchool].[GR], [dbo].[StuSchool].[ETH], [dbo].[StuSchool].[PRIMEXCP], [dbo].[StuSchool].[DOB], [dbo].[StuSchool].[PMSCHL], [dbo].[ODR_v2].[Hours], [dbo].[ODR_v2].[GroupID4], [dbo].[StuSchool].[SCHL], [dbo].[ODR_v2].[TERMS_Empl] FROM [dbo].[ODR_v2] INNER JOIN [dbo].[StuSchool] ON [dbo].[ODR_v2].[StudentID] = dbo.StuSchool.ENRKSTDT WHERE ((dbo.ODR_v2.ID<2315 or dbo.ODR_v2.ID IS NULL)) and ((1=1) and (upper(dbo.StuSchool.ENRLAST) like upper(N'%sponge%'))) ORDER BY 3 DESC

SELECT top 1 [dbo].[ODR_v2].[StudentID], [dbo].[ODR_v2].[Incident_Date], [dbo].[ODR_v2].[ID], [dbo].[ODR_v2].[Incident_Time], [dbo].[ODR_v2].[Describe_Behavior], [dbo].[ODR_v2].[Parent_Contact], [dbo].[ODR_v2].[Parent_Contact_Date], [dbo].[ODR_v2].[Parent_Contact_Detail], [dbo].[ODR_v2].[Action_Recommended], [dbo].[ODR_v2].[Incident_Location], [dbo].[ODR_v2].[Possible_Motivation], [dbo].[ODR_v2].[Persons_offending], [dbo].[ODR_v2].[Num_of_Offenders], [dbo].[ODR_v2].[Teacher_Email], [dbo].[ODR_v2].[Admin_Email], [dbo].[ODR_v2].[Consequence_Date], [dbo].[ODR_v2].[Consequence_Date_Thru], [dbo].[ODR_v2].[Num_Days], [dbo].[ODR_v2].[Parent_Phone], [dbo].[ODR_v2].[Parent_Contact_Date_Admin], [dbo].[ODR_v2].[Parent_Contact_Time], [dbo].[ODR_v2].[Parent_Contact_Type], [dbo].[ODR_v2].[Admin_Comments], [dbo].[StuSchool].[ENRLAST], [dbo].[StuSchool].[ENRFRST], [dbo].[StuSchool].[GR], [dbo].[StuSchool].[ETH], [dbo].[StuSchool].[PRIMEXCP], [dbo].[StuSchool].[DOB], [dbo].[StuSchool].[PMSCHL], [dbo].[ODR_v2].[Hours], [dbo].[ODR_v2].[GroupID4], [dbo].[StuSchool].[SCHL], [dbo].[ODR_v2].[TERMS_Empl] FROM [dbo].[ODR_v2] INNER JOIN [dbo].[StuSchool] ON [dbo].[ODR_v2].[StudentID] = dbo.StuSchool.ENRKSTDT WHERE ((dbo.ODR_v2.ID>2315)) and ((1=1) and (upper(dbo.StuSchool.ENRLAST) like upper(N'%sponge%'))) ORDER BY 3 ASC
Microsoft SQL Server Native Client 10.0 error '80040e31'
Query timeout expired
/odr/include/aspfunctions.asp, line 1243



It looks like your query takes long time to execute causing SQL Server timeout. Here is the article that explains how to print all executed queries on the web page:

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

admin 10/17/2012

You need to run all those queries manually to find which one may take long time to execute. Then you need to find a way to speed up this query i.e. add indexes etc.

G
gdmacdo author 10/18/2012

2 good things in one day. First, it turned out to be a bad index. I deleted the indexes and re-added them and it solved the problem. I appreciate being pointed in the right direction.
Second good thing, ASPRunner 7.2 is OUT!!!!! Great product. Thank you for your support and excellent products.



You need to run all those queries manually to find which one may take long time to execute. Then you need to find a way to speed up this query i.e. add indexes etc.