DataSource Controls :: How To Know Current Active Sheet Name In C#

May 12, 2010

i am creating a web based application in which user can upload excel file. my code is :

string ExcelConString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FileName + ";Extended Properties=Excel 8.0";
OleDbConnection oledbConn = new OleDbConnection(ExcelConString);
OleDbDataAdapter oda = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", oledbConn);
DataSet ds = new DataSet();
oda.Fill(ds);

it works fine, but when user rename the sheet1 than run time error occured plz help me how to know active sheet NAME through c#/vb.net OR how to know first sheet NAME.

View 1 Replies


Similar Messages:

Forms Data Controls :: How To Select Details From Microsoft Excel Sheet Without Writing Sheet Name

Jun 25, 2010

I am developing web application using csharp.How can I select details from Microsoft Excel sheet without writing sheet Name? At the moment when selecting details from Excel sheet I specify Excel sheet name like below I am using Payments$. Is it possible to use a number or something else.

[Code]....

View 2 Replies

DataSource Controls :: Column Count Of An Excel Sheet?

Feb 22, 2010

I am trying to get column count of an Excel sheet. I need count of only those columns which are explicity defined by sheet creator. Columns other than explicitly defined take the form F20,F21... which i dont want to include in my counting. I am using

Provider=Microsoft.ACE.OLEDB.12.0 to access data.

View 1 Replies

DataSource Controls :: Using LINQ To Read Excel Sheet?

Aug 15, 2010

I want to use use LINQ to read a excel sheet of 80 columns without using OLEDB first.

Is it possible to do that?If so pls send the code.

Is it possible to read Excel sheet using LINQdataSource.

View 2 Replies

DataSource Controls :: How To Load Data From Excel Sheet To Sql Server

Jan 26, 2010

how to load the data from excell sheet to sql server.. that is i have data in excell sheet with four columns..

so i am trying to create sam four columns in sql server table..

then how to trsnfer the data from excell to sqlserver?

View 4 Replies

DataSource Controls :: Uploading Data From Excel Sheet Into DB Dynamically

Jun 28, 2010

I want to upload data from an Excel Sheet into my DB. Now my major requirement is, I do not know the header count in the files to be uploaded and they may vary, for example one file may have 3 headers while some may have 6. and I want data of both these files to go into a single DB. That is, I want to dynamically generate columns in my DB, and store these values. So how do I go about achieving this.

View 4 Replies

DataSource Controls :: How To Import Excel Sheet Into Sql Server 2005

Jun 2, 2010

i have excel sheet i need it to be imported entire sheet into sql server 2005 i need the query to complete the task..

View 3 Replies

DataSource Controls :: Using MS SQL Stored Procedure Read Excel Sheet?

Feb 11, 2010

Can I use MS SQL Server 2005 stored procedure to read data from MS Excel sheet and write into the table.I don't want to do it using C# or any other programming langauage. Simply using stored procedure should read sheet and write into SQL tables.Is its possible to do? If yes, then give me suggestions/sample tutorials for the same.

View 2 Replies

DataSource Controls :: Export Data From Sql Server Table To Excel Sheet?

Jan 13, 2010

I am developing a Standalone Application where i have to exprot data from sqltable to excelSheet..

View 6 Replies

DataSource Controls :: Copy The Data Of The Excel Sheet To The Sqlserver Table?

Feb 18, 2010

i am Using sql server 2005. i want to copy the data of the excel file to the table.

i wrote the query like :

INSERT INTO test(empId,empName,empMailId,empContactNo)
SELECT *
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C: estExcel.xls',
'SELECT * FROM [Sheet1$]')

got the following error :

SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online.

then did this

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
GO
RECONFIGURE;
GO

again am trying the same above query ,now am getting the following error:

Msg 7399, Level 16, State 1, Line 1 The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" reported an error. The provider did not give any information about the error. Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".

i want to copy the data of the excel sheet to the table.

View 2 Replies

DataSource Controls :: Upload Data From Excel Sheet To A Table In Sql Server 2008?

Feb 1, 2010

i have an aspx page which has a fileuploader and a button

initially i have to browse the file and after browsing the file i have to check the extension if the extension is xsl or xslx then only i have to enable the submit button

once the submit button is enabled i have to insert this data into the table

and i have to display the number of succesfully inserted rows and no of unsuccessfull insertions .

success and failure is dependent on the mismatch of the datatype between the excel sheet and the database column

i am coding in c# but am unable to upload.

View 2 Replies

DataSource Controls :: Insert A Date From Excel Sheet To Sql Server 2005 DateTime Field.

Jan 25, 2010

I want to read date field from Excel sheet and insert it into SQL Server2005.When I read date field it gives me a number say '40160' when the date feild is "08/01/2010"

How should to Read a date field from Excel Sheet Cells?

View 2 Replies

Set MenuItem As Active Using CSS Class Based On URL Of Current Page

Aug 16, 2012

I have a .aspx page where i copied 1 navigation bar. On it i put some link buttons. They are navigating. But when I click it's class should become Active <li class="active">Home</li>. If i click on register link button then register's class should become active. 

View 1 Replies

Active Directory/LDAP :: Retrieve The GUID For The Current User?

Dec 9, 2010

I need to retrieve the GUID for the Current User? I've found that it's possible with DirectoryEntry, but is there a way I can do it in similar fashion to WindowsIdentity.GetCurrent.User.Value - which actually returns the SID?

View 3 Replies

DataSource Controls :: Sql Query For Active Directory Users?

Apr 28, 2010

I ran the following in my active directory server, and it completed successfully.

[Code]....

Can I query from a different server in order to get the active directory users?When I try to run the following query, it says.'Could not find server 'ADSI' in sysservers. Execute sp_addlinkedserver to add the server to sysservers'.I need to be able to query active directory users from a different server as I'll have to do a table join at some point. Right now I'm just trying to get a basic query of users to return.

View 2 Replies

DataSource Controls :: Create CSV Using Current Filtering

Feb 24, 2010

I currently have a common file that's responsible for exporting the users GridView to a CSV file which works fine, mostly. The problem is that it only exports the current gridview display, and being that I have it paged, it can be cumbersome to get all the data to an excel sheet when there can be upwards of 20 pages of data. The GridView has a LINQ datasource as follows

[Code]....

How do I get the results of the preceeding datasource? Or is there a better way to get ahold of that data before it is paged?

View 1 Replies

DataSource Controls :: Current Day On Select Statment?

Jun 24, 2010

looking for solution to fix the code every day i change by manual how can fix to current day.SelectCommand="SELECT * FROM articles WHERE (date > '23 / 06 / 2009') ORDER BY date"how can change the to current time direct

View 5 Replies

Web Forms :: Create New Sheet And Copy First 3 Rows From First Sheet In C#

Jan 2, 2013

I need to write the content of 1000 records in an excel using the excel object in c#.net.

In one excel i need to write only 100 records and if the record exceeds more than 100 record i need to create a new sheet and have to write the content but the need is, i have designed a header in the first 3 rows of the header in the first excel and i need write to the first 3 rows in the 2nd sheet also.

View 1 Replies

DataSource Controls :: How To Select Current Week Records

Jan 27, 2010

I want to select the records of current week, Starting day should be from saturday till Friday.

I can fetch the records of current week:

[Code]....

but starting day of week is Sunday and ending is Saturday.

What I want is, Starting day should start from Saturday and ending day should be Friday.

View 11 Replies

DataSource Controls :: How To Pull Only The Current Month Data From SQL

Jan 20, 2010

How would you pull only the current month data from SQL?

View 9 Replies

DataSource Controls :: How To Get The Current Identity Number When Doing Insert

May 20, 2010

The scenario is that I wanna insert a record to the database via INSERT query and I need to user the identity number of this record in the INSERT query.

But I don't know how to achieve this.

Here is my table structure and code for your better understanding.

There are three columns in the Table: categoryID, categoryName, categoryPath. I need the path based on the categoryID which is an identity int column.

Now I used this code to do INSERT:

[Code]....

View 6 Replies

DataSource Controls :: The Name 'DetailsView1' Does Not Exist In The Current Context

May 8, 2010

I am new to LINQ, but learning Quickly. I get this error "Error 1 The name 'DetailsView1' does not exist in the current context C:UsersUserdocumentsvisual studio 2010WebSitesDursoftHRAGeneral.aspx.cs 40 9 C:...DursoftHR" for the code behind listed below:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class AGeneral : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
viewCompanyInfo();
}.......

"The name 'DetailsView1' does not exist in the current context" is the error I get.

View 5 Replies

DataSource Controls :: The Name 'Common' Does Not Exist In The Current Context?

May 11, 2010

I get the above error using this code. What am I missing?

[Code]....

View 4 Replies

DataSource Controls :: How To Update A Table With Current Date And Time

Aug 2, 2010

How can I update a table with current date and time using sqldatasource control?

View 2 Replies

DataSource Controls :: Retrieving And Displaying Only Current User's Data?

Jan 21, 2010

Having trouble with a web page and connecting to SQL DB. Basically I have a form view table connected up to a SQLDataSourceControl and what I want displayed in the form is only data that has been assigned to the user that is logged on now. I have a "ViewAll" page, which lists EVERY field, regardless of who it is assigned to, but the "MyTasks" page should only retrieve the data of the current user.

I have two tables in my DB, the "Users" table, with user data (including an ID number) - this is used again in the "Tasks" table as a foreign key called "AssignTo". Therefore if user Joe Bloggs with ID number 5 logs on, whenever someone assigns a task to him, they will select number 5 in the "Task" table, as this relates to his User ID.

View 10 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved