How To Query and Update Excel Data Using ADO From ASP

  • Thread starter Thread starter Stan the Mouse
  • Start date Start date
S

Stan the Mouse

http://support.microsoft.com/?id=195951

In this link, it talks about how to update the Excel by
ASP (VB), I would like to know how to add a new data into
the field, I try once by using "addnew", but it actually
filled all my emtpy fields with the same data at once,
can anyone help me please? thanks

e.g.

e.g

Before I run that ASP, my excel file has a range with
data like below:

fldTopic fldName fldFace fldMail fldHomepage
fldContent
Testing4 Mouse 4 (e-mail address removed)
Sing

After I run the ASP which I would like to only fill in
the next data as below:

fldTopic fldName fldFace fldMail fldHomepage
fldContent
Testing4 Mouse 4 (e-mail address removed)
Sing
Testing5 Mouse 4 (e-mail address removed)
Test again.

But unfortunately, it fills the range that I've declared
until that range is
full, like below:

fldTopic fldName fldFace fldMail fldHomepage
fldContent
Testing4 Mouse 4 (e-mail address removed)
Sing
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.
Testing5 Mouse 4 (e-mail address removed)
Test again.

until it is full, e.g. upto row 65536 in excel.

Thanks
 
Stan the Mouse said:
http://support.microsoft.com/?id=195951

In this link, it talks about how to update the Excel by
ASP (VB), I would like to know how to add a new data into
the field
e.g
Before I run that ASP, my excel file has a range with
data like below:

fldTopic fldName fldFace fldMail fldHomepage fldContent
Testing4 Mouse 4 (e-mail address removed) Sing

After I run the ASP which I would like to only fill in
the next data as below:

fldTopic fldName fldFace fldMail fldHomepage fldContent
Testing4 Mouse 4 (e-mail address removed) Sing
Testing5 Mouse 4 (e-mail address removed) Test again.

But unfortunately, it fills the range that I've declared
until that range is full

For ASP, I wouldn't recommend using a recordset to update a data
source. I'd use SQL DML: INSERT INTO, UPDATE and DELETE (Excel doesn't
support DELETE, though).

You Excel table appears to be a defined Name ('named Range') which
extends to row 65536 on a worksheet. This would mean you table is
already full, albeit with nulls! Better to define the Name's range to
coincide with the UsedRange (i.e. just the part with data), in which
case it would expand to fit inserted rows, or use the sheet name as
the table name (possibly with a Range address if required). So, for
your example, I'd use:

INSERT INTO [MySheet$]
(fldTopic, fldName, fldFace, fldMail, fldHomepage, fldContent)
VALUES ('Testing5', 'Mouse', NULL, 4, '(e-mail address removed)', 'Test
again')
;

Jamie.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top