Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

DELETE in Excel as Datasource VB.net OR workaround

Posted on 2014-11-03
3
275 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

828 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