Solved

DELETE in Excel as Datasource VB.net OR workaround

Posted on 2014-11-03
3
268 Views
Last Modified: 2014-11-04
I'm using Excel 2013 as a datasoure.  I am unable to perform DELETE commands on rows when using as a datasource.  I am using the following provider for my ADODB: Provider=Microsoft.ACE.OLEDB.12.0

Is there a way to perform a delete or an elegant workaround?   Can I perform a SELECT statement and get the specific row of a record?  If so I could delete the row via VB.net.  Would prefer this to having to search through the table for a matching record.
0
Comment
Question by:HyperBPP
  • 2
3 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 40421129
>>I'm using Excel 2013 as a datasoure.

As that is NOT a database then your problem makes sense.
For solutions consider automating Excel (not via ADODB) or changing the datasource to a database (eg. Access or SQL Server) or just overwriting the contents of that row should that be acceptable.
0
 
LVL 6

Author Comment

by:HyperBPP
ID: 40421511
Is there a way to identify the target row without having to loop through every record?  Like is there a recordset select statement that can say which row number a record came from?

I'm not certain I understand what you mean by "Automating Excel"?  Is this embedded macro or the idea of directly accessing cells?  If the latter I still have the undesirable loop through every record.
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 40421569
Excel is not a database, functionality that one expects from a database might not exist or is only difficult to reproduce in Excel.

>>Is there a way to identify the target row without having to loop through every record?
Yes, but then again no.  Depends on what you have.

>>Automating Excel
When you have code like (air code):
ExcelApp app = ....
app.WorkSheet(0).Rows(5).Delete();
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access Excel export not behaving 2 25
Filling Blank Cells 14 19
excel help 4 19
Autofit all columns of all worksheets using VBA 14 0
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now