Databases :: Reading From An Excel Spreadsheet - Fields With Numbers Are Showing As DBNull

Nov 8, 2010

My web app is allowing the user to load a column of data from an Excel spreadsheet. For whatever reason, as it parses the data, fields that are just integers are coming up as System.DBNull. (Code in VB.NET but I work with C# as well, so feel free to post C# solutions)

[Code]....

dataRow(0) is System.DBNull when the Excel file has a number in Column A. Here's what the Excel looks like

Column A
100S200
WEIRD
ABCDEFG
123456
100S12791
119655902
100S12792
105E17530
123456 and 119655902 come through as DBNull

View 8 Replies


Similar Messages:

Generated Excel Spreadsheet: Numbers Received As Text?

Jan 5, 2011

I am generating, using a ASP routine, Visual Basic, a HTML table in a file to be read by MS Excel.

After Excel reads the file, some of the numbers (in some cells) are shown as "text", not numbers: they cannot be operated upon, like decimal numbers. (added, subtracted...)

If I click in a "number" stored as "text" cell, I can "edit" the cell and remove an invisible "apostrofe" to the left of the number; after that, the "text" becomes "number" again.

Seems like Excel is inserting a non-visible character before the number, so that it is stored as "text"

It happens to some lines and not to others...

View 1 Replies

Databases :: Excel Spreadsheet Not Returning All Cells?

Jun 22, 2010

I've tried many combonations and looked over may websites for sample code but no matter what I do I only getting a few cells of data from my Excel DataSet.

CODE:

using System;

View 1 Replies

Databases :: Excel Upload Large Numbers Of Rows?

Sep 25, 2010

i am trying to upload an excel to an oracle data base (10g xe) the excel has arround 46000 rows.I am getting the following error when i do a insert

ORA-06550 string 1 line 1,

PLS-00123: program too large (Diana nodes

View 1 Replies

Databases :: Reading Data From An Excel Workbook (.xls)

Mar 1, 2011

I have a scenario where I have to read an excel file to dump records in a mysql database. The code generates an exception Sheet1 not found. I have pasted the code below. Please let me know the solution to the exception. I have given the correct read/write/modify settings to my excel file.

if (fileUpload1.PostedFile.FileName.EndsWith(".xls") || fileUpload1.PostedFile.FileName.EndsWith(".XLS"))
{
string fileName = Server.MapPath(fileUpload1.PostedFile.FileName);
string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties=Excel 8.0";
// Create the connection object
OleDbConnection oledbConn = new OleDbConnection(connString);
try
{
// Open connection
oledbConn.Open();
// Create OleDbCommand object and select data from worksheet Sheet1
OleDbCommand cmd = new OleDbCommand("SELECT * FROM [Sheet1$]" , oledbConn);
// Create new OleDbDataAdapter
OleDbDataAdapter oleda = new OleDbDataAdapter();
oleda.SelectCommand = cmd;
// Create a DataSet which will hold the data extracted from the worksheet.
DataSet ds = new DataSet();
// Fill the DataSet from the data extracted from the worksheet.
oleda.Fill(ds, "RestaurantExcelData");
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
Response.Write("Data: " + ds.Tables[0].Rows[i].ItemArray[0].ToString() + "");
}
}
catch(Exception e1)
{
}
finally
{
// Close connection
oledbConn.Close();
}
}
else
{
Response.Write("File Not Excel (xls||XLS)");
}

View 2 Replies

Databases :: Reading Excel Data To SQL Database

Sep 23, 2010

Using C# to develop an application.I need to upload data ( which is in excel) to a sql table.

[Code]....

View 1 Replies

Databases :: Reading Data From Excel 2007?

Aug 3, 2010

I am attempting to read data from an uploaded spreadsheet using ACE.OLEDB. The code, which is running fine on dev and test machines for XL2003/2007 reports "Exernal table is not in the expected format" error on connecting on the production server for XL2007 only.The code is

Dim connectionString As String = "provider=Microsoft.Ace.OLEDB.12.0;" _ & "Data Source='" & ImportData.FullName & "';Extended Properties=Excel 12.0;" LogWebActivity.LogThis("Entering POPSUKD, ConStr=" & connectionString, LogWebActivity.LogDetailLevel.DetailAndData) Dim con As New System.Data.OleDb.OleDbConnection(connectionString) LogWebActivity.LogThis("Dimmed con", LogWebActivity.LogDetailLevel.Debugging) Try Dim cmdSelect As New System.Data.OleDb.OleDbCommand("SELECT * FROM [" & WorksheetName & "$]", con) Dim adapter As New System.Data.OleDb.OleDbDataAdapter(cmdSelect) Dim dS As New Data.DataSet LogWebActivity.LogThis(cmdSelect.CommandText, LogWebActivity.LogDetailLevel.Debugging) con.Open() LogWebActivity.LogThis("Opened Connection", LogWebActivity.LogDetailLevel.Debugging) adapter.Fill(dS, WorksheetName) LogWebActivity.LogThis("Filled DataAdapter", LogWebActivity.LogDetailLevel.Debugging) _SKUS = dS.Tables(WorksheetName) LogWebActivity.LogThis("Set SKUS", LogWebActivity.LogDetailLevel.Debugging)

View 1 Replies

Databases :: Page Times Out Reading Excel File?

Mar 31, 2010

I have some code that reads records from an excel file and then imports that data into an sql database. The issue only happens when the excel file has more then 350 rows in it. In the middle of the import it just stops executing and I get directed to the 'Internet Explorer cannot display the webpage' page or just a blank page when using firefox.

I dont get any time out errors or any error at all but still I tried messing around with the script timeout settings but still does the same thing at about the 2 min 30 sec mark.

[Code]....

View 2 Replies

Databases :: Reading Excel File Without Saving To Disk First?

Aug 31, 2010

I need to be able to read an excel file from a file upload control but I can not save the file to disk first, it must be done in memory.

[Code]....

Above is my code for reading the data file if it IS saved to disk, but again, I have to be able to do this without saving the file to disk, it must be done in memory. I have not been able to find any sample code anywhere on how to do this from memory, everything seems to force the file be uploaded, saved to disk, and then read in the connection string, which again I can not do.

View 2 Replies

Databases :: Reading Hyperlinked Page In Excel File Using C#?

Nov 19, 2010

I understand how to use a connection string object to read excel sheets. What I don't know is how to follow a hyperlink inside excel, grab matching data from the linked page and return it to my database. Essentially, the spreadsheet has two columns:

Title | Class#

Class# has the hyperlink which links to an internal web site. The connected page has a course description and any pre-required classes that must be taken before you can take this class. This is where I'm rather stumped as I've not had to do this type of thing before.

View 4 Replies

Databases :: Reading And Writing MS Excel (2007) Files?

Mar 4, 2011

Want to create a web based application for reading and writing excel files.

Issue :

1. Want to upload an excel file and store it some location.
2. Read data from excel file, performing some sorting and filtering
3. Write filtered data to new excel file.

View 1 Replies

Databases :: Reading From Excel File With Warning 'number Stored As Text'

Jun 8, 2010

in my application i have to read from an excel files and check the value of every cell i'm using an OleDb connection to open it and reading but i have this issue if some of the cells in the excel sheet is having this warning when i try to read it returns DBNull ??could any one give me a clue ....knowing that i can not force the user for not having this warning ...i have to solve this within my code .

View 5 Replies

Databases :: Uploading An Excel (.xls) File To Server And Showing It To Grid View?

Apr 25, 2010

[Code]....

i have successfully showed data using puting directpath in to a textbox(e.g, filename=TextBox1.Text;). but the code above is not working. i dont know why.

View 1 Replies

Generate Excel Spreadsheet From CSV?

Nov 15, 2010

Possible Duplicate: Create Excel (.XLS and .XLSX) file from C#

I have some code that generates a zip file that contains multiple CSV files and streams it back to the user (no file is saved on the server). However, I want to create an excel workbook instead (can be traditional xls or Office Open XML xlsx format) with each CSV 'file' being a spreadsheet.

How can I do this, without resorting to Office Automation on the server or a commercial 3rd party component?

View 4 Replies

Display Graph From Excel Spreadsheet?

Jun 10, 2010

I'm working on a project which requires me to plot a graph using Visual Studio ASP.Net from a data I've collected either in .txt or .xml format. The data consist of, eg. 15 records, but I'm only needed to plot 8 graphs out of the 15 records.

View 1 Replies

How To Freeze The Header Row In An Excel Spreadsheet

Feb 25, 2010

I'm exporting an ASP.NET gridview to Excel using the following function. The formatting is working really well, except I need to freeze the header row in Excel on the export. I'm really trying to avoid using a 3rd party Excel plugin for this, but unless there's some archaic excel markup in my AddExcelStyling function.

[code]....

View 2 Replies

Two Dimensional Array To Excel Spreadsheet

Jun 22, 2010

I have a 2 dimensional array, I want to convert it to an Excel document using C#.

View 2 Replies

SQL Server :: FileUpload Excel Spreadsheet?

Aug 13, 2010

I'm trying to upload an excel spreadsheet using the FileUpload control, read the excel sheet using OleDb connection, and save the strings onto a sql server database.Then, I'm trying to read each string in another method.My web app is currently hosted on the network on my local box, and using savePath= @"C:desktop" like I had it previously wasn't working, so I figured using a sql server database would work for being able to save the file and open it again... but I'm getting confused on how to do so, so i tried using my old savePath but it's not working anymore. So... I'm really at a lost on what to do and how to fix it.

[Code]....

View 1 Replies

Create Excel Spreadsheet In Website

Nov 14, 2011

On an .aspx page in a web site I need to retrieve some data from a sql server database and, instead of displaying it in a Gridview, I need to put the data in a spreadsheet and present the user with a Save As dialog.

I'd prefer to do it without using the Office / Excel / Interop com object - so, from what I've read so far, I can do this by returning XML data from SQL Server?

Normally I get data from SQL Server and populate a dataset or datareader with it - and then use this as the Datasource of a GridView.

If I run this in SQL Server ...

Code:
SELECT UserID, UserName FROM tblUsers FOR XML Auto, Root('Users')

It produces this ...

Code:
<Users>
<tblUsers UserID="1" UserName="Steve" />
<tblUsers UserID="2" UserName="Andrea" />
<tblUsers UserID="3" UserName="Zebedee" />
</Users>

So, first question - how do I get the data from SQL Server into my .aspx page? (All data access is done with stored procedures - so, from my data access class normally I create, for example, a SQLDataReader and populate it by calling a stored procedure. What object would I populate with the results of a stored procedure that contains a select statement with 'FOR XML Auto'

Then, assuming I get the XML into the .aspx page - how do I get it into a spreadsheet so that there are two columns called UserID and UserName and 3 rows with 1, 2 and 3 in the first cell and Steve, Andrea and Zebedee in teh second cell?

View 9 Replies

Globalize/Localize Excel Reports Using Spreadsheet?

May 28, 2010

My company has new customers in Brazil and we realized that our excel reports are not working when our Brazilian customers tried to open the reports in their Brazilian versions of excel.

For excel output we use spreadsheet gear in our vb.net web application. Our excel worksheets are fairly simple. Mostly outputted text/numbers/dates, a couple of formulas (sum, if) and formatting on the currency and dates.

I've tried several methods to get my excel reports to work: First I left the excel workbook in the "en-US" culture and tried simply chaging the number format for Brazil to:

_-[$R$-416] * #.##0,00_-;-[$R$-416] * #.##0,00_-;_-[$R$-416] * "-"??_-;_-@_-

And this formatted the regular cells but the formulas still failed to show a value. Instead they showed a 0 value.

Next I tried changing the workbook to the "pt-BR" culture and that also forced me to translate the formula names (Sum -> Soma, If -> Se) but they still wouldn't should a value and instead showed a #Name/#Nome error. Interestingly enough the formulas would work if I edited the cell and hit enter. The formula wouldn't change but it would some how fix that cell.

I need to be able to out excel reports that can format dates/currencies and apply simple formulas (IF, Sum) for other excel cultures.

View 1 Replies

Accessing Excel 2010 (xlsx) Spreadsheet?

Feb 24, 2011

I would like to access an Excel 2010 spreadsheet via ASP.NET 4 - what is the best (i.e. straight forward) method to do this? I would like to update the spreadsheet via ASP then read the results of the data from Excel back to a web form.

View 9 Replies

Exporting Gridview Contents To Excel Spreadsheet?

Feb 25, 2010

I have a gridvidew (GV2). I want the user to be able to export the contents of this gridview to an excel spreadsheet for offline processing.

Here is my subroutine:

[code]...

On clicking the ExcelButton I get the error message:

Control 'GV2' of type 'GridView' must be placed inside a form tag with runat=server.

The control GV2 is in fact inside:

<form id="form1" runat="server"></form>

View 1 Replies

Copy And Paste From An Excel Spreadsheet To A Control?

Oct 21, 2010

I would like to be able to copy one row and five columns from an Excel spreadsheet to a table like structure on a ASP.NET web form. The idea is keeping the data in the exact row and column from Excel to the table like control on the ASP.NET web-form. Then I want to be able to save to the contents of the ASP.NET control to a database by a buttoon command click. What ASP.NET control would allow me to do this? Gridviews and datagrids don't seem to allow me to do this.

View 1 Replies

C# - Generate And Email An Excel Spreadsheet Without Saving It?

Mar 3, 2011

My host does not allow me to save files to the file system, but I would like to be able to send some reports via email as Excel attachments.

How can I generate and the file without actually saving it to disk?

View 2 Replies

How To Show Information From An Excel Spreadsheet In A Web Page

Jun 10, 2010

I want to show information from an excel spreadsheet in a web page. The xls will have maybe 5 columns, and as many rows as needed. The columns will be 'Name', 'Created Date', 'Expired Date', 'Owner', and maybe down the road maybe more.

What I would like is for the C# to nightly read the xls, and display the information in a table on the website.

If there is a PDF available for download I am going to link that as well.

View 1 Replies







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