473,289 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

Updating Excel from DataSet

This is more likely a question for an SQL group but as I'm using powershell
and dotnet it may
be relevant

Overview: I'm trying to pull data from Excel into a DataSet - modifying the
DataSet - then updating the excel source

I have got to the point where I think I need Update and Delete Command
strings for the DataAdapter but I'm at a loss as to what to do

Here is what I have so far

$xlCS = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\myExcelWorkBook;Extended Properties="Excel 8.0;HDR=YES;"'
$xlQS = "SELECT * FROM [Sheet1$]"
$xlDA = New-Object System.Data.OleDb.OleDbDataAdapter ($xlQS, $xlCS)
$xlDS = New-Object System.Data.DataSet "myDataSet"
$xlDA.Fill($xlDS)

$xlDS.Tables[0].Columns | Select ColumnName

ColumnName
----------
Serial Number
Last Report Time
Machine Name
Asset Tag
Chassis Type
OS Name
OS Service Pack
User

I then delete a bunch of rows, add some columns and data to the dataset

Now I need to pull those changes back into the DataAdapter

$xlDA.Update($xlDS)
0

Zero Changes!

I figure the DataAdapter Delete/Insert/Update Commands need to be filled out
with an object of type System.Data.OleDb.OleDbCommand

But what are the commands I need? I've checked out some basic SQL command
sites but it's all a bit greek to me right now.

Any help appreciated!

Neil

Jul 19 '07 #1
1 1755
Hi Neil

This maybe a bit out of the box but what if you wrote the file back
out as a comma delimited or tab delimited then opened this in Excel?

Might be cheating but would be easier (I think).

Cheers
Mike

Aug 21 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Chris | last post by:
Could someone please provide me an effective means of exporting data from a data set (or data grid) to Excel?
9
by: Paul | last post by:
Hi all Arggghhh........... The problem.....I want the user to be able to create an excel document and name particular cells in the document where they want the data to be placed and then save...
1
by: Luis Esteban Valencia | last post by:
Hello Everyone, Iam an intermediate ASP.Net programmer and iam facing a challenging task. I have a table in MS-SQL server database called 'Members'. The table has following fields... ...
1
by: Ramakrishnan Nagarajan | last post by:
Hi, I am converting Excel data into a Dataset in C#. There are around 24 columns in the Excel Sheet. First I tried to insert one row with correct values in the Excel sheet. i.e. for text columns...
4
by: Geoff | last post by:
Hi I'm hoping somebody can help me with the following problem that has occurred to me. Suppose I have two tables in an SQL Server database. Let's call these tables A and B. Assume that A has...
1
by: Anonieko | last post by:
Here are some of the approaches. 1. Transform DataGrid http://www.dotnetjohn.com/articles.aspx?articleid=36 3. Use the Export approach ...
2
by: Mad Scientist Jr | last post by:
>From an asp.net web page I want the user to open the results of a SQL query in Excel, as automatically as possible (ie not having to loop through columns, rows, in code). For this,...
1
by: DennisBetten | last post by:
First of all, I need to give some credit to Mahesh Chand for providing me with an excellent basis to export data to excel. What does this code do: As the title says, this code is capable of...
5
by: Bill Schanks | last post by:
I have a winform app (VB 2005) that allows users to export data to excel, make updates to the excel file and import the data from that Excel file and update the database. My question is: Is it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.