Forums

This topic is locked

Strange behaviour with my recordset & show region

Posted 08 Oct 2001 20:42:16
1
has voted
08 Oct 2001 20:42:16 Kevin Abbott posted:
Hi,

I have a recordset which filters data from a menu object on the same page. What happens is users have to select an item from a dynamic list (on the same page). When the page is submitted the information about that item is displayed on the same page (submitting to its self page).

I had it working brilliantly, but now something has gone wrong. This is the strange part if I don't use Show Region if recordset is not empty I get a "ADODB.Field error '800a0bcd'" error on the first submit, on the second submit it displays the data fine. On the third it doesn't and so on...

And if I do use Show Region if recordset is not empty it submits but no data is shown.

This was working fine before and I've tried everything to right it and it hasn't worked.

Here is my asp code:

<%@LANGUAGE="JAVASCRIPT"%>
<%
// *** Logout the current user.
MM_Logout = String(Request.ServerVariables("URL") + "?MM_Logoutnow=1";
if (String(Request("MM_Logoutnow")=="1" {
Session.Abandon();
var MM_logoutRedirectPage = "../../../default.asp";
// redirect with URL parameters (remove the "MM_Logoutnow" query param).
if (MM_logoutRedirectPage == "" MM_logoutRedirectPage = String(Request.ServerVariables("URL");
if (String(MM_logoutRedirectPage).indexOf("?" == -1 && Request.QueryString != "" {
var MM_newQS = "?";
for (var items=new Enumerator(Request.QueryString); !items.atEnd(); items.moveNext()) {
if (String(items.item()) != "MM_Logoutnow" {
if (MM_newQS.length > 1) MM_newQS += "&";
MM_newQS += items.item() + "=" + Server.URLencode(Request.QueryString(items.item()));
}
}
if (MM_newQS.length > 1) MM_logoutRedirectPage += MM_newQS;
}
Response.Redirect(MM_logoutRedirectPage);
}
%>
<!--#include file="../../../Connections/projectstore.asp" -->
<%
// *** Edit Operations: declare variables

// set the form action variable
var MM_editAction = Request.ServerVariables("URL";
if (Request.QueryString) {
MM_editAction += "?" + Request.QueryString;
}

// boolean to abort record edit
var MM_abortEdit = false;

// query string to execute
var MM_editQuery = "";
%>
<%
// *** Insert Record: set variables

if (String(Request("MM_insert") != "undefined" {

var MM_editConnection = MM_projectstore_STRING;
var MM_editTable = "tblStore";
var MM_editRedirectUrl = "software.asp";
var MM_fieldsStr = "hfSaveFinger|value|hfSaveProject|value|hfSaveUser|value|tfLicence|value|tfDate|value";
var MM_columnsStr = "fnSoftware|',none,''|fnProject|',none,''|fnUser|',none,''|fnLicence|',none,''|fnNeeded|',none,''";

// create the MM_fields and MM_columns arrays
var MM_fields = MM_fieldsStr.split("|";
var MM_columns = MM_columnsStr.split("|";

// set the form values
for (var i=0; i+1 < MM_fields.length; i+=2) {
MM_fields[i+1] = String(Request.Form(MM_fields[i]));
}

// append the query string to the redirect URL
if (MM_editRedirectUrl && Request.QueryString && Request.QueryString.length > 0) {
MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&" + Request.QueryString;
}
}
%>
<%
// *** Insert Record: construct a sql insert statement and execute it

if (String(Request("MM_insert") != "undefined" {

// create the sql insert statement
var MM_tableValues = "", MM_dbValues = "";
for (var i=0; i+1 < MM_fields.length; i+=2) {
var formVal = MM_fields[i+1];
var MM_typesArray = MM_columns[i+1].split(",";
var delim = (MM_typesArray[0] != "none" ? MM_typesArray[0] : "";
var altVal = (MM_typesArray[1] != "none" ? MM_typesArray[1] : "";
var emptyVal = (MM_typesArray[2] != "none" ? MM_typesArray[2] : "";
if (formVal == "" || formVal == "undefined" {
formVal = emptyVal;
} else {
if (altVal != "" {
formVal = altVal;
} else if (delim == "'" { // escape quotes
formVal = "'" + formVal.replace(/'/g,"''" + "'";
} else {
formVal = delim + formVal + delim;
}
}
MM_tableValues += ((i != 0) ? "," : "" + MM_columns[i];
MM_dbValues += ((i != 0) ? "," : "" + formVal;
}
MM_editQuery = "insert into " + MM_editTable + " (" + MM_tableValues + " values (" + MM_dbValues + "";

if (!MM_abortEdit) {
// execute the insert
var MM_editCmd = Server.CreateObject('ADODB.Command');
MM_editCmd.ActiveConnection = MM_editConnection;
MM_editCmd.CommandText = MM_editQuery;
MM_editCmd.Execute();
MM_editCmd.ActiveConnection.Close();

if (MM_editRedirectUrl) {
Response.Redirect(MM_editRedirectUrl);
}
}

}
%>
<%
var rsProdlist = Server.CreateObject("ADODB.Recordset";
rsProdlist.ActiveConnection = MM_projectstore_STRING;
rsProdlist.Source = "SELECT fnProduct FROM tblSoftware ORDER BY fnProduct ASC";
rsProdlist.CursorType = 0;
rsProdlist.CursorLocation = 2;
rsProdlist.LockType = 3;
rsProdlist.Open();
var rsProdlist_numRows = 0;
%>
<%
var rsProddetails__MMColParam = "1";
if(String(Request.Form("muSoftware") != "undefined" {
rsProddetails__MMColParam = String(Request.Form("muSoftware");
}
%>
<%
var rsProddetails = Server.CreateObject("ADODB.Recordset";
rsProddetails.ActiveConnection = MM_projectstore_STRING;
rsProddetails.Source = "SELECT * FROM tblSoftware WHERE fnProduct = '"+ rsProddetails__MMColParam.replace(/'/g, "''" + "' ORDER BY fnProduct ASC";
rsProddetails.CursorType = 0;
rsProddetails.CursorLocation = 2;
rsProddetails.LockType = 3;
rsProddetails.Open();
var rsProddetails_numRows = 0;
%>

Hope someone can help and thanks in advance.

Reply to this topic