Ask a Question related to ASP Database, Design and Development.
-
michaaal #1
How can I add to existing Record Set?
I use code like this in order to create a recordset and enter data into the
recordset:
strSQL = "SELECT * FROM InventoryItemList WHERE Desc LIKE '%red%';"
set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" &
Server.MapPath("database.mdb")
set recset = conn.execute (strSQL)
response.write(recset("Item"))
recset.movenext
How can I do an additional query and add it to the existing recordset
without removing the data from the first recordset. Maybe something like
this?...
strSQL = "SELECT * FROM InventoryItemList WHERE Desc LIKE '%blue%';"
set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" &
Server.MapPath("database.mdb")
'I changed the line below as well as the first line
set recset.AddToRecordset = conn.execute (strSQL)
response.write(recset("Item"))
recset.movenext
I realize that I could change the first line to:
strSQL = "SELECT * FROM InventoryItemList WHERE Desc LIKE '%red%' AND Desc
LIKE '%blue%';"
.....but I would like to avoid that in order to avoid a bunch of re-coding of
my site.
Any ideas?
michaaal Guest
-
Edit Existing Record
Hi All My scenario is as follows: I have a page where users can edit existing records. Within this page I have several dropdownlists which is bound... -
Disabling a field when editing an existing record in a Datagrid
I created an ASP.net form with an editable datagrid on it. I can create new records, and update and delete existing records. The problem I have is... -
Stop adding record in subform after record count = 1
Can someone help in in what to put after the THEN statment to allow one entry if the Record count is =>1 in the Before insert or should I set the... -
Adding a new record when the record source is a query.
Hello All, I have a form that runs a query. The reason it runs on a query is because prior to it opening I have a form from which you can pick... -
Update existing From record with changes on new To record
I need to create a history record and update a current record from one input form. The two tables are joined with a query and the table names and... -
Bob Barrows [MVP] #2
Re: How can I add to existing Record Set?
michaaal wrote:
It's not possible. Forget about this approach.> I use code like this in order to create a recordset and enter data
> into the recordset:
>
> strSQL = "SELECT * FROM InventoryItemList WHERE Desc LIKE '%red%';"
> set conn = Server.CreateObject("ADODB.Connection")
> conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" &
> Server.MapPath("database.mdb")
> set recset = conn.execute (strSQL)
> response.write(recset("Item"))
> recset.movenext
>
> How can I do an additional query and add it to the existing recordset
> without removing the data from the first recordset. Maybe something
> like this?...
>
> strSQL = "SELECT * FROM InventoryItemList WHERE Desc LIKE '%blue%';"
> set conn = Server.CreateObject("ADODB.Connection")
> conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" &
> Server.MapPath("database.mdb")
> 'I changed the line below as well as the first line
> set recset.AddToRecordset = conn.execute (strSQL)
> response.write(recset("Item"))
> recset.movenext
You mean " ... OR Desc LIKE '%blue%'">
> I realize that I could change the first line to:
> strSQL = "SELECT * FROM InventoryItemList WHERE Desc LIKE '%red%' AND
> Desc LIKE '%blue%';"
Several:>
> ....but I would like to avoid that in order to avoid a bunch of
> re-coding of my site.
>
> Any ideas?
1. Open a new recordset that uses both the old and new criteria.
2. Use two recordsets
3. Add the data from each new recordset to an array.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest



Reply With Quote

