473,396 Members | 2,011 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,396 software developers and data experts.

Accessing Excel Data in the Query using c# ,.net 2003 and sql 2000

I want to Open an excel sheet , then I want to loop through the rows in the excel sheet and should execute an update query for all the rows where the where condition in the query should match the columns of the excel sheet.
Eg:
Update Employee set Dept= ‘AAA’ where employeenumbers= Excelsheet firstcolumn
So I want to loop this query for all the rows in the excel data.
The excel sheet will contain only employee numbers as the first column
The where condition can be for any columns in the excel sheet.
i have already opened the excel sheet using the OLEDB .
Sep 19 '07 #1
1 3123
Hi,

You mentioned that you are using OLEDB to open an excel file so i dont need to explain the details about it. to filter the information in your excel file and to fill the dataset with that filtered records you may copy the code below for your reference.

string strSheetName="Sheet1"
System.Data.OleDb.OleDbDataAdapter MyCommand
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [" + strSheetName + "$]", MyConnection)
DS = New System.Data.DataSet
MyCommand.Fill(DS)

Regards,
Ruel


I want to Open an excel sheet , then I want to loop through the rows in the excel sheet and should execute an update query for all the rows where the where condition in the query should match the columns of the excel sheet.
Eg:
Update Employee set Dept= ‘AAA’ where employeenumbers= Excelsheet firstcolumn
So I want to loop this query for all the rows in the excel data.
The excel sheet will contain only employee numbers as the first column
The where condition can be for any columns in the excel sheet.
i have already opened the excel sheet using the OLEDB .
Sep 19 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: RK | last post by:
Hi, In my application, I need to copy data from an Excel file into a SQL table. The article related to this can be found at http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B306572 ...
1
by: Tim | last post by:
Hi, I have a need to process a column of data and get information from SQL 2000 and return it to the Excel Spread Sheet. The data will be a list of order numbers in column 1. I need to look...
4
by: D | last post by:
I've created a report with many subreports of aggregate data. I want my client to be able to export this data to Excel to make her charts, etc. Only one problem: one of the fields is a "SchoolYear"...
0
by: Mike Knight | last post by:
(I've also posted this problem on microsoft.public.excel.programming) I have a MS Access 2003 Database named "AS400 Fields.mdb". This database contains links to tables on an AS400. In MS...
17
by: Mansi | last post by:
I need to do some research on how to use excel automation from c#. Does anyone know of any good books related to this subject? Thanks. Mansi
1
by: Barbara Alderton | last post by:
I’m relatively new to .NET. I would like to write a VB.NET app (I read that using C# isn't as elegant when dealing with Office products) that reads in Excel files (forms) of both 2000 and 2003...
3
by: Ian Dunn | last post by:
I'm simply trying to access an instance of Excel that has been opened manually by the user in order to put a few values in the existing sheet. Here's the code I've tried: Dim oXL As...
0
by: sradoff | last post by:
I wish to use XPath to access data from within an Excel generated XML Spreadsheet (generated with MS Excel 2003). I am using an asp Web page (not .NET, not at this time). I instantiate...
0
NeoPa
by: NeoPa | last post by:
Many of us have noticed that there are some very useful functions available to you when using Excel, but these same functions are not available, as standard, in Access. A particular issue I had...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.