Ask a Question related to ASP Database, Design and Development.
-
Gary D. Rezek #1
Load Empty Recordset
Hi All,
Is it possible to load an empty recordset into a page for the purpose of setting up the page for a new record?
The following code
(there is also a Case "edit" and a Case "delete" which work fine)
CASE "add"
strSQL = "SELECT * "
strSQL = strSQL & "FROM tblPatents " strSQL = strSQL & "WHERE PatentID = 0;"
Set rst = server.CreateObject("ADODB.Recordset")
rst.Open strSQL, cnMain, 1, 3, &H0001
Gives me the following error
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
Which I certainly agree with, but is there a way around it. My page's controls use value=<%= rst("Value")%> for their value so I
can't (at least to my knowledge) not have a recordset.
Thank you.
gdr
--
Gary D. Rezek
University Networking Services
South Dakota State University
Gary D. Rezek Guest
-
Show region if recordset is not empty
Hi? How can I make server behavior for this?: If Diet field empty in the food table,Don?t display Diet word in the Page <% If Not Food.EOF... -
Show if recordset is empty??
Hi, I have a results page with two result boxes and am trying to add 'Show if recordset is empty' for obvious reasons. BUT i've highlighted text... -
#25885 [Opn->Csd]: mail() causes apache2 to crash when message is empty, and headers is non-empty
ID: 25885 Updated by: sniper@php.net Reported By: ben at krackeler dot com -Status: Open +Status: ... -
#25885 [NEW]: mail() causes apache2 to crash when message is empty, and headers is non-empty
From: ben at krackeler dot com Operating system: WinXP PHP version: 4.3.3 PHP Bug Type: Mail related Bug description: ... -
Set an Empty Recordset?
You could throw in a rsQuery.Movelast Sometimes what I'll do in testing is: CONST TRAP_STOP = 10 DIM TRAP_COUNT TRAP_COUNT = 1 -
Ray at #2
Re: Load Empty Recordset
What is it that you're trying to accomplish?
Ray at work
"Gary D. Rezek" <Gary_Rezek@NOSPAMsdstate.edu> wrote in message
news:%23KHmH9gVDHA.2104@TK2MSFTNGP10.phx.gbl...setting up the page for a new record?> Hi All,
> Is it possible to load an empty recordset into a page for the purpose of0;"> The following code
> (there is also a Case "edit" and a Case "delete" which work fine)
> CASE "add"
> strSQL = "SELECT * "
> strSQL = strSQL & "FROM tblPatents " strSQL = strSQL & "WHERE PatentID =Requested operation requires a current record.> Set rst = server.CreateObject("ADODB.Recordset")
> rst.Open strSQL, cnMain, 1, 3, &H0001
>
> Gives me the following error
>
> Either BOF or EOF is True, or the current record has been deleted.controls use value=<%= rst("Value")%> for their value so I>
> Which I certainly agree with, but is there a way around it. My page's> can't (at least to my knowledge) not have a recordset.
> Thank you.
>
> gdr
> --
> Gary D. Rezek
> University Networking Services
> South Dakota State University
>
>
Ray at Guest
-
Gary D. Rezek #3
Re: Load Empty Recordset
Hi Ray,
I'm trying to setup a page somewhat based on the ASP101 Database Editing sample
[url]http://www.asp101.com/samples/db_edit.asp[/url] (using asp source code)
Where they are building a page (form) to do the edit and AddNew procedures I want to use a "pre-defined" page; i.e. (in this
case) ResearcherStaffPatents.asp; for both the edit and AddNew records. Also they add the new values programmatically in the
AddNew portion of their example which I cannot seem to use for my purpose.
Thank you.
gdr
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message news:%2328wfAhVDHA.3332@tk2msftngp13.phx.gbl...> What is it that you're trying to accomplish?
>
> Ray at work
>
> "Gary D. Rezek" <Gary_Rezek@NOSPAMsdstate.edu> wrote in message
> news:%23KHmH9gVDHA.2104@TK2MSFTNGP10.phx.gbl...> setting up the page for a new record?> > Hi All,
> > Is it possible to load an empty recordset into a page for the purpose of> 0;"> > The following code
> > (there is also a Case "edit" and a Case "delete" which work fine)
> > CASE "add"
> > strSQL = "SELECT * "
> > strSQL = strSQL & "FROM tblPatents " strSQL = strSQL & "WHERE PatentID => Requested operation requires a current record.> > Set rst = server.CreateObject("ADODB.Recordset")
> > rst.Open strSQL, cnMain, 1, 3, &H0001
> >
> > Gives me the following error
> >
> > Either BOF or EOF is True, or the current record has been deleted.> controls use value=<%= rst("Value")%> for their value so I> >
> > Which I certainly agree with, but is there a way around it. My page's>> > can't (at least to my knowledge) not have a recordset.
> > Thank you.
> >
> > gdr
> > --
> > Gary D. Rezek
> > University Networking Services
> > South Dakota State University
> >
> >
>
Gary D. Rezek Guest
-
Ray at #4
Re: Load Empty Recordset
Okay, so then what are you stuck on? How to get the column names from the
table? How to insert a record? Are you getting an error? What code do you
have so far?
Ray at home
--
Will trade ASP help for SQL Server help
"Gary D. Rezek" <Gary_Rezek@NOSPAMsdstate.edu> wrote in message
news:u$wU5RhVDHA.3924@tk2msftngp13.phx.gbl...sample> Hi Ray,
> I'm trying to setup a page somewhat based on the ASP101 Database EditingI want to use a "pre-defined" page; i.e. (in this> [url]http://www.asp101.com/samples/db_edit.asp[/url] (using asp source code)
> Where they are building a page (form) to do the edit and AddNew proceduresAlso they add the new values programmatically in the> case) ResearcherStaffPatents.asp; for both the edit and AddNew records.> AddNew portion of their example which I cannot seem to use for my purpose.
> Thank you.
>
> gdr
>
Ray at Guest
-
Gary D. Rezek #5
Re: Load Empty Recordset
I'm sorry about this, but I don't know how else to go about it, so I really hope this helps.
This deals with 2 pages:
ResearcherStaffPatents.asp - which is where I want to be able to Add or Edit records.
ResearcherStaffPatent_AddEdit.asp - which has a listing of all of a participants patents and they may chose to delete or add or
edit a particular patent.
Below is the code on page ResearcherStaffPatents.asp. It is being 'called' by ResearcherStaffPatent_AddEdit.asp by using a
querystring action, like so:
<a href="ResearcherStaffPatents.asp?action=edit&id=<% = rst.Fields("Patentid").Value %>">Edit</a>
<a href="ResearcherStaffPatents.asp?action=delete&id= <%= rst.Fields("Patentid").Value %>">Delete</a>
<a href="ResearcherStaffPatents.asp?action=add">Add a new record</a>
************************************************** ********************************
**ResearcherStaffPatents.asp**
<<connection info, DIM's, etc>>
strAction = LCase(Trim(Request.QueryString("action")))
SELECT CASE strAction
CASE "edit"
<<this works>>
CASE "delete"
<<this works>>
CASE "add"
strSQL = "SELECT * " 'using * until this works
strSQL = strSQL & "FROM tblPatents "
strSQL = strSQL & "WHERE PatentID = 0;"
'-----------------------------------------------------------
Set rst = server.CreateObject("ADODB.Recordset")
rst.Open strSQL, cnMain, 1, 3, &H0001
rst.AddNew
rst.Fields("ParticipantID") = intParticipantID
rst.Fields("PatentYear") = ""
rst.Fields("PatentNumber") = ""
rst.Fields("PatentTitle") = ""
rst.Fields("PatentStatus") = ""
rst.Fields("CampusIPO") = 0
rst.Fields("Authors") = ""
rst.Update
CASE Else
'do nothing
END SELECT
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<FORM action="ResearcherStaffPatent_AddEdit.asp" method=post id=ResearcherStaffPatents_AddEdit
name=ResearcherStaffPatents_AddEdit>
<P><FONT face=Arial><STRONG>PATENTS</STRONG></FONT></P><BR>
<P><FONT face=Arial size=2>Report only those patents awarded since January 1, 2001
acknowledging EPSCoR support. Do not report patents that are "pending". List all
staff who participated in patent writing.</FONT></P>
<P>
<TABLE cellSpacing=2 cellPadding=4 width="90%" border=0>
<TR>
<TD><STRONG> Pa tent Year: </STRONG><INPUT id="txtPatentYear"
style="WIDTH: 100px; HEIGHT: 22px" size=59 value="<%=rst("PatentYear")%>" name="txtPatentYear" tabindex="1"></TD></TR>
<TR>
<TD><STRONG>Patent Number: </STRONG><INPUT id="txtPatentNumber"
style="WIDTH: 461px; HEIGHT: 22px" size=59 value="<%=rst("PatentNumber")%>" name="txtPatentNumber" tabindex="2"></TD></TR>
<TR>
<TD><STRONG>
Patent Title: </STRONG><INPUT id="txtPatentTitle"
style="WIDTH: 461px; HEIGHT: 22px" size=59 value="<%=rst("PatentTitle")%>" name="txtPatentTitle" tabindex="3"></TD></TR>
<TR>
<TD> <STRONG>Patent Status:</STRONG>
<INPUT id="radPatStatusApplied" type="radio" value="applied" name="radPatentStatus" tabindex="4" <%If
rst("PatentStatus")="applied" Then%>checked<%End If%>> Applied For
&n bsp;
<INPUT id="radPatStatusGranted" type="radio" value="granted" name="radPatentStatus" tabindex="5" <%If
rst("PatentStatus")="granted"Then%>checked<%End If%>> Granted</TD></TR>
<TR>
<TD><STRONG>Was the Patent Application through the Campus Intellectual Property Office?</STRONG>
<INPUT id="radCampusIPOYes" type="radio" value="Yes" name="radCampusIPO" tabindex="6" <%If rst("CampusIPO")= True
Then%>checked<%End If%>> Yes
&n bsp;
<INPUT id="radCampusIPONo" type="radio" value="No" name="radCampusIPO" tabindex="7" <%If rst("CampusIPO")= False
Then%>checked<%End If%>> No</TD></TR>
<TR>
<TD><STRONG> &n bsp;
Authors: </STRONG><INPUT id="txtAuthors"
style="WIDTH: 462px; HEIGHT: 22px" size=59 value="<%=rst("Authors")%>" name="txtAuthors" tabindex="8"></TD></TR>
</TABLE></P>
<P align=center>Please click on Submit to continue to the appropriate links to submit additional required
information.</P>
<P align="center">
<TABLE cellSpacing="1" cellPadding="1" width="50%" border="1">
<TR>
<TD>
<P align="center"><INPUT type=button id=submit1 name=submit1 value=Submit
onclick="location.href='ResearcherStaffPatent_AddE dit.asp?action=<%=strAction%>'"></P>
</TD>
<TD>
<P align="center"><INPUT id=reset1 type=reset value=Reset name=reset1></P>
</TD>
<TD>
<P align="center"><INPUT type=button id=Home name=Home value=Home onclick="location.href='home_rs.asp'"></P>
</TD>
<TD>
<P align="center"><INPUT type=button id=Logout name=Logout value=Logout onclick="location.href='Logout.asp'"></P>
</TD>
</TR>
</TABLE></P>
************************************************** *******************************
<<And here is where I am stuck>>
If I use this the way Case "add" stands now, I will enter a new record, with no data except for the PatentID and ParticipantID,
just by clicking the <Add New Record> button from ResearcherStaffPatent_AddEdit.asp with no way to delete it if I leave the
ResearcherStaffPatents.asp page for some reason (I think, but I am quite new to .asp).
If I remove (comment out) all the references to the .AddNew rst.Fields("xxx") and try and use the empty recordset as the Record
Source to ResearcherStaffPatents.asp I get the error I mentioned in my first post. ( Either BOF or EOF is True, or the current
record has been deleted. Requested operation requires a current record.)
If I bypass the SQL statement, i.e. by just opening the form, the page error I get is, Type mismatch: 'rst', and then gives a
line number which references the 'rst' in the value criteria of txtPatentYear.
I hope this will give an idea of what I am trying to do and the problems I am having doing it.
Thank you.
gdr
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message news:OFplNRjVDHA.612@TK2MSFTNGP10.phx.gbl...> Okay, so then what are you stuck on? How to get the column names from the
> table? How to insert a record? Are you getting an error? What code do you
> have so far?
>
> Ray at home
>
> --
> Will trade ASP help for SQL Server help
>
>
> "Gary D. Rezek" <Gary_Rezek@NOSPAMsdstate.edu> wrote in message
> news:u$wU5RhVDHA.3924@tk2msftngp13.phx.gbl...> sample> > Hi Ray,
> > I'm trying to setup a page somewhat based on the ASP101 Database Editing> I want to use a "pre-defined" page; i.e. (in this> > [url]http://www.asp101.com/samples/db_edit.asp[/url] (using asp source code)
> > Where they are building a page (form) to do the edit and AddNew procedures> Also they add the new values programmatically in the> > case) ResearcherStaffPatents.asp; for both the edit and AddNew records.>> > AddNew portion of their example which I cannot seem to use for my purpose.
> > Thank you.
> >
> > gdr
> >
>
Gary D. Rezek Guest



Reply With Quote

