.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

IE problem with copy past from Excel to IE

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :ASP.Net

Hello, guys

Im having a problem with ie only, firefox , chrome and opera work fine if i copy some values from a column an excel an past to a textbox,

but at IE is pasting just first value .....

View Complete Post

More Related Resource Links

While Importing Excel 2007 file to Datatable - headerrow problem


Hi there,


I am trying to simply extract an excel data from an uploaded file an put it into a datatable. In this case the excel file has 3 rows but when I fill the datatable I only see row count of 2.

I tried changing HDR:NO; to HDR:YES and vice versa, but no luck. 

What am I doing wrong? (Note: the excel file cannot have a  headerrow)


string connstr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + pFilePath + ";Extended Properties=\"Excel 12.0;IMEX=1;HDR:NO;\"";
            OleDbConnection conn = new OleDbConnection(connstr);
            DataTable dtTables = conn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, null);
            string strTablename = dtTables.Rows[0]["TABLE_NAME"].ToString();
            string strSQL = "SELECT * FROM [" + strTablename + "]";

            OleDbCommand cmd = new OleDbCommand(strSQL, conn);

            DataTable dt = new DataTable();
            OleDbDataAdapter da = new OleDbDataAdapter(cmd);
            //At this point row count=2 which doesn't make sense




Excel-like experience - gridview focus problem



I'm creating a page where people can order several items from a list without having to press "edit" and "save" in between like you normally would in a gridview. The user writes down the quantity, and finally presses a "submit" button that saves the order.

I want the user to have a windows form (or excel) like eperience, so once the user puts in the quantity and moves on to the next item, either by TAB or by clicking on the TextBox, i make some calculations without the user beeing bothered with a full refresh or having to press a buton to execute the event, so I place the controls inside an UpdatePanel and use TextBox.TextChanged. The event runs code that calculates the sum for the row (price * quantity) and shows that in a column called "Sum", and updates a label in a fixed position with the new order total ("Total").

Any ideas on how to achieve this?

Right now I use a GridView with a templatefield for the Quantity and set the TextBox.TextChanged event to fire to make the calculations. The problem is that the focus then changes.

By using SmartNavigation or the ScriptManager.SetFocus I manage to retain focus on the TextBox that executed the Postback, but the user might have moved on to a textbox far down the gridview (thus causing the postback by leaving the previo

reading excel file problem



i have 200 rows in my excel file. im using OleDbConnection to read the excel file.

The problem is that it will read all the blank rows from row 200 onwards. Is there a configuration im missing ? or is there a way to import all rows that has data? Here's some of my code.

string excelConnectionString =
               "Provider=Microsoft.Jet.OLEDB.4.0;" +
                "Data Source=" + filePath + ";" +
                "Extended Properties=Excel 8.0";

OleDbConnection excelConnection =
                    new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties='Excel 8.0;HDR=NO'");

OleDbCommand cmd = new OleDbCommand("Select * from [list$]",excelConnection);

Problem with Excel


Hi All,

I am trying to create hyperlink in Excel using below code, But it is giving me error:

Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))System.Runtime.InteropServices.COMException (0x80020005): Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))


 Dim oXL As Excel.Application
Dim oWB As Excel._Workbook
Dim oSheet As Excel._Worksheet

oXL = New Excel.Application()
oWB = DirectCast(oXL.Workbooks.Add(True), Excel._Workbook)
oSheet = DirectCast(oWB.ActiveSheet, Excel._Worksheet)

oSheet.Hyperlinks.Add(oSheet.Cells("A3"), "http://www.MySite.com", Nothing, "My Site Info", "clickhere")

It is giving the error on the above line when trying to create hyperlink.

Can you please tell me where I am doing wrong.




Excel problem

I m operning excel file using Applicaion object of Excel,InteropNow i am closing it but it doesn't release from memoryIt's process is runnig like Excel.exeHow can i release it.

Excel Connection Manager Problem

I am building a package that has 2 tasks that need to use the same excel connection manager. I use a execute sql task to dynamically build a table from the headers of the excel sheet  ,then I use an excel source component to load the data from the sheet. However when I try to edit the excel source and switch the data access mode to a variable and select the variable(for the path), when I try to close the editor I get this message 'S:\myfolder'.  It is already opened exclusively by another user, or you need permission to view its data. I need this package to access the same folder each time because the files will be placed in that folder. This package also has a branch for loading a text file into sql server. It access the same folder but uses a flatfile connection manager It looks like permissions on the folder are correct

Problem opening excel

hello everyone, i m having a serious problem, and i have been searching for days and i couldn't find a solution, my application deployed on IIS 7.5 is working very good except when trying to open excel file, i am getting an error telling me that the path is wrong or page is already used or the workbook you are trying to save already exists. to open excel m using: Dim xlApp = new Excel.application Dim xlWorkbook = new Excel.workbook Dim xlWorksheet = new Excel.worksheet   xlapp = new Excel.application xlworkbook = xlapp.workbooks.open(xxx) and here is the line of error !!!!     it seems to be a problem with the security privileges of the users, i have been told to find the excel application in Component services - COM+ and change it's security, but the problem is that i can't find the excel application in COM+ so i have tried this: Component services - mycomputer - properties - COM security - Edit default(for acces, launch and activiation permissions) and grant it for Network Service, USers and IIS_IUsers and still that did not work out.   any solution?  

How to copy sqlServer table into excel sheet with sheet name as sheet1?

hello all,I want to copy each table(from selserver database) in separate sheet of Excelwith Sheet name different from table name..........So the issue is that when I open Excel Sheet it show sheetname same as filename I just want to name it as Sheet1,Sheet2 and so onI can copy table from SqlServer(MS Sql Server 2005) into Excel Sheet as follows:public static void ExportDataTableToExcel(DataTable dt, string filename)         {             System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;             // first let's clean up the response.object             response.Clear();             response.Charset = "";             // set the response mime type for excel             response.ContentType = "application/vnd.ms-excel";             response.AddHeader("Content-Disposition", "attachment;filename=\"" + filename + "\"");   &nb

Excel - Move or Copy using c#

Hi Experts,            I need your help,i like to copy 2 sheets from one workbook to other one which I created newly.I am using VS 2008 with c#.Please give code snippets for move or copy sheets from one book to other. Thanks in advance RegardsDinesh babu.

data type problem in import data from excel file


Dear All,

I am importing the data from excel file using following code.

connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(strFolderFileName) & ";Extended Properties=HTML Import;"
                conn = New OleDbConnection(connstr)
                Dim strSQL As String = "SELECT * FROM [" & strWorkSheetName & "]"

                Dim cmd As New OleDbCommand(strSQL, conn)

                Dim da As New OleDbDataAdapter(cmd)

Now the problem is if a coulmn vlaue start with a number value like "15" then the other string value like "W15" in that column is ignored in the datatable.

eg. The excel column value     Column1


Problem with Linked servers from sql 2005 to Excel file


I am probably doing something stupid BUT I am creating a linked server to an excel file, I have done this on sql2005sp2x64 using the ace ole 12 provder, and replicated on another machine running sql2005sp2x32 using the jet4 provider and I am having the same problem on both.  I have turned allow inprocess option on on both providers.  I as an administrator on the machine where the database and datafile are residing have no problem accessing the linked server and the file underneath however any enduser that is not in the local administrators group gets the error   Cannot initialize the data source object of OLE DB provier "Either provider I have tried" for linked server    SQL Server Error 7303.  I have checked file permissions, and they are open to the world, I have tried both use existing authentication and use no authentication when accessing the linked server.  and I have tried endless different combinations of providers and provider strings.  I have went as far as having the enduser create a linked server to an excel file on his local machine (which he is admin on and I am not)   and he can access the file .. and I can not.  so I am just assuming there is some sort of security setting somewhere .. that I am just missing.



lalith: Please help i am crying from past 1week : problem is: Report from 'DISCO Document' is 'Ro


The document at the url http://spd:16841/_vti_bin/UserGroup.asmx was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'http://spd:16841/_vti_bin/UserGroup.asmx' is 'The document format is not recognized (the content type is 'text/html; charset=utf-8').'.
- Report from 'DISCO Document' is 'Root element is missing.'.
- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=utf-8').'.
- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=utf-8').'.


one of biggest sad in my life is above error which i am not getting correct solution from microsoft.

Excel problem


Hi all,

             I am trying to fetching the data from Book1.xlsx file. The program is not working and throws an exception.Please check the code and tell me where I am doing the mistake?


protected void Page_Load(object sender, EventArgs e)
        string con = ConfigurationManager.ConnectionStrings["xlsx"].ConnectionString;

        using (OleDbConnection myConnection = new OleDbConnection(con))
                OleDbCommand myCommand = new OleDbCommand("SELECT * FROM [Cities$]", myConnection);
                 OleDbDataReader reader = myCommand.ExecuteReader();

                    GridView1.DataSource = reader;
            catch (Exception ex)
                Response.Write("An error: " + ex.Message);

The exception is:

An error: The Microsoft Office Access database engine cannot open or write to the file ''. It is alre

problem with worklow - update remote copy


hi, I have downloaded a worklow form here http://wssactivities.codeplex.com/

I just cant seem to update item  into another site, I keep getting the below errors

Value does not fall within the expected range.    at Microsoft.SharePoint.SPList.GetItemById(Int32 id, String strRootFolder, Boolean cacheRowsetAndId)
   at Microsoft.SharePoint.SPList.GetItemById(Int32 id)
   at MyLocalBroadband.Activities.WSS.Utilitie


Problem with referencing Excel version


Apologies if this is in the wrong place and needs to be moved.

I've built a small application which takes in Excel data, manipulates it and creates a workbook with charts. The PC I first built it on has Excel 2003, 2007 and 2010 installed and I referenced the Microsoft.Office.Interop.Excel (version 11.0) dll. When I transferred to a client's PC which had only Excel 2003, I got a compile error and had to redo the reference to Excel. When I transferred again to another of the client's PCs which had only Excel 2007 installed, it again threw a compile error and I had to reference the version 12.0 Excel object library. Naturally, going back, this version didn't work on the PC with only Excel 2003 installed.

Is there a way round this, other than to build separate versions of the application for each version of Excel? Thanks in advance for any help.

Read only error trying to copy and paste rows of records from Excel spreadsheet


I'm using Sharepoint 2010 and trying to open a list in Edit in Datasheet View. The list opens but when I try to paste lines into the sheet I get a Read-only error and it doesn't accept my paste. I removed all required fields.

I'm using XP and IE8

This function was working in SharePOint 2007.


SSRS 2008 export to Excel margin problem

When rendering report from SSRS 2008 with custom margins (let's say 0.5in) into Excel, margins do not export correctly, or do not export at all, thus Excel sets its default margins.

I heard in SSRS 2005 it was not a problem.

Any ideas?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend