-
DSN Lost on Edit
I have an aspdb grid which populates fine... but when I hit the Edit Button, I get DataSourceName not found... Anybody know why? Code included below... The connection information is coming from a previous screen...
Thanks
Joe
<%@ Language=VBScript %>
<SCRIPT id=DebugDirectives runat=server language=javascript>
// Set these to true to enable debugging or tracing
@set @debug=false
@set @trace=false
</SCRIPT>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<H1> Flight Range Maintenance </H1>
<Script Language="JavaScript">
function EditValidate()
{
EffDtVal = document.EDFORM_101.effective_dt.value;
EffDt = EffDtVal.valueOf();
DiscDtVal = document.EDFORM_101.discontinue_dt.value;
DiscDt = DiscDtVal.valueOf();
if( EffDt > DiscDt )
{
alert( '
The Effective date cannot be greater than the discontinue Date.
Please try again.' );
return false;
}
return true;
}
</Script>
<P>
<%
Dim connect_string
' Set variables needed for connection
userid=Request.Form("txtUserid"
connect_string = "DSN=" & Request.Form("lstDatabase" & ";UID=" & Request.Form("txtUserid" & ";PWD=" & Request.Form("txtPassword"
EF = ""
EF = "id[0], range_start_i, range_stop_i, airline_cd_s, op_airline_cd_s, range_type, descr, rev_managed_ind_c, effective_dt, discontinue_dt, 10[timestamp(mm/dd/yyyy)], 11[userid]"
' Response.Write(connect_string)
'Create the ASP-db™ object:
Set MyDb = Server.CreateObject("ASP.db"
'Set up DSN
MyDb.dbDSN = connect_string
MyDB.dbDBType="SQL"
MyDb.dbColor = "7" ' Pick color scheme 7
MyDB.dbUnit = 101 ' This is an identifier for the grid
MyDb.dbMode = "dual" ' Want both Grid and Form
MyDb.dbGridTableTag="BORDER=3" ' Set table border=3
MyDB.dbNavigationItem = "Prev, Edit, Next, Add, Update, Delete"
'Select which Table and Fields to show:
MyDb.dbSQL = "Select * FROM aag_flt_range"
MyDB.dbNameMap = "range_id_i, ID; range_start_i, Range Start; range_stop_i, Range Stop; airline_cd_s, Airline; op_airline_cd_s, Operating Airline; descr, Description;range_type, Range Type; rev_managed_ind_c, Revenue Managed; effective_dt, Effective Date; discontinue_dt, Discontinue Date; mod_dt, Last Modified Date;mod_id, Last Modified By"
MyDb.dbEditFlds = EF
MyDB.dbEditParams = "tablename=aag_flt_range, BookMarkFlds = range_start_i+range_stop_i+effective_dt,recordscop e=single,EditValidateName=EditValidate()"
MyDb.dbEditAddROFlds = "range_id_i, mod_dt, mod_id"
MyDb.dbEditUpdateROFlds = "range_id_i, mod_dt, mod_id"
MyDB.dbTestBlankSQL = "Select first 1 range_start_i from aag_flt_range"
MyDb.ASPdb ' Show the Database now!
%>
</BODY>
</HTML>
-
DSN Lost on Edit (reply)
Joe,
You must save the request(lstDatabase) etc the first time in. Subsequent page displays (like when edit is clicked) causes request to be empty. So just save it in a sesion variable. We have many examples of this on our site at:
http://www.aspdb.com/apps (example 60 is a good one to look at)
Mark.
------------
Joe Beernink at 11/14/00 1:35:45 PM
I have an aspdb grid which populates fine... but when I hit the Edit Button, I get DataSourceName not found... Anybody know why? Code included below... The connection information is coming from a previous screen...
Thanks
Joe
<%@ Language=VBScript %>
<SCRIPT id=DebugDirectives runat=server language=javascript>
// Set these to true to enable debugging or tracing
@set @debug=false
@set @trace=false
</SCRIPT>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<H1> Flight Range Maintenance </H1>
<Script Language="JavaScript">
function EditValidate()
{
EffDtVal = document.EDFORM_101.effective_dt.value;
EffDt = EffDtVal.valueOf();
DiscDtVal = document.EDFORM_101.discontinue_dt.value;
DiscDt = DiscDtVal.valueOf();
if( EffDt > DiscDt )
{
alert( '
The Effective date cannot be greater than the discontinue Date.
Please try again.' );
return false;
}
return true;
}
</Script>
<P>
<%
Dim connect_string
' Set variables needed for connection
userid=Request.Form("txtUserid"
connect_string = "DSN=" & Request.Form("lstDatabase" & ";UID=" & Request.Form("txtUserid" & ";PWD=" & Request.Form("txtPassword"
EF = ""
EF = "id[0], range_start_i, range_stop_i, airline_cd_s, op_airline_cd_s, range_type, descr, rev_managed_ind_c, effective_dt, discontinue_dt, 10[timestamp(mm/dd/yyyy)], 11[userid]"
' Response.Write(connect_string)
'Create the ASP-db™ object:
Set MyDb = Server.CreateObject("ASP.db"
'Set up DSN
MyDb.dbDSN = connect_string
MyDB.dbDBType="SQL"
MyDb.dbColor = "7" ' Pick color scheme 7
MyDB.dbUnit = 101 ' This is an identifier for the grid
MyDb.dbMode = "dual" ' Want both Grid and Form
MyDb.dbGridTableTag="BORDER=3" ' Set table border=3
MyDB.dbNavigationItem = "Prev, Edit, Next, Add, Update, Delete"
'Select which Table and Fields to show:
MyDb.dbSQL = "Select * FROM aag_flt_range"
MyDB.dbNameMap = "range_id_i, ID; range_start_i, Range Start; range_stop_i, Range Stop; airline_cd_s, Airline; op_airline_cd_s, Operating Airline; descr, Description;range_type, Range Type; rev_managed_ind_c, Revenue Managed; effective_dt, Effective Date; discontinue_dt, Discontinue Date; mod_dt, Last Modified Date;mod_id, Last Modified By"
MyDb.dbEditFlds = EF
MyDB.dbEditParams = "tablename=aag_flt_range, BookMarkFlds = range_start_i+range_stop_i+effective_dt,recordscop e=single,EditValidateName=EditValidate()"
MyDb.dbEditAddROFlds = "range_id_i, mod_dt, mod_id"
MyDb.dbEditUpdateROFlds = "range_id_i, mod_dt, mod_id"
MyDB.dbTestBlankSQL = "Select first 1 range_start_i from aag_flt_range"
MyDb.ASPdb ' Show the Database now!
%>
</BODY>
</HTML>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|