Click here to Skip to main content
15,913,280 members
Home / Discussions / C#
   

C#

 
GeneralRe: Draw functions don't work Pin
Ennis Ray Lynch, Jr.30-Oct-07 8:20
Ennis Ray Lynch, Jr.30-Oct-07 8:20 
GeneralRe: Draw functions don't work Pin
Manfr3d30-Oct-07 8:42
Manfr3d30-Oct-07 8:42 
GeneralRe: Draw functions don't work Pin
Manfr3d30-Oct-07 11:18
Manfr3d30-Oct-07 11:18 
QuestionReading dbf, tables not completely filled Pin
JoZ CaVaLLo30-Oct-07 6:43
JoZ CaVaLLo30-Oct-07 6:43 
AnswerRe: Reading dbf, tables not completely filled Pin
snorkie30-Oct-07 7:16
professionalsnorkie30-Oct-07 7:16 
GeneralRe: Reading dbf, tables not completely filled Pin
JoZ CaVaLLo30-Oct-07 23:36
JoZ CaVaLLo30-Oct-07 23:36 
GeneralRe: Reading dbf, tables not completely filled Pin
snorkie31-Oct-07 3:34
professionalsnorkie31-Oct-07 3:34 
AnswerRe: Reading dbf, tables not completely filled - Similar w/ Excel Pin
David Atchison21-Oct-11 7:37
David Atchison21-Oct-11 7:37 
I'm having a similar problem with an Excel file.

I’ve been trying to read in an Excel file using either a DataSet or DataTable with OleDbDataAdapter. Here’s the code snippet:

//Identify the data source Excel file

sLine = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";

sLine += sFilePathAndName;

sLine += ";Extended Properties=Excel 8.0";

OleDbConnection con = new OleDbConnection(sLine);

con.Open();
sLine = "SELECT * FROM [PublishCalendarSpreadOneOff$]";

OleDbDataAdapter DataAdapt = new OleDbDataAdapter(sLine, con);

//Construct a data table to hold the data

DataTable DataTbl = new DataTable();

//Fill the data table with the spreadsheet data

DataAdapt.Fill(DataTbl); // ERROR this doesn't fill the data column if there's no data in the first row.

if (con != null) con.Close();

This ought to fill DataTbl with the spreadsheet data and does so with one problem. If the first row of data (not the column headers but the data) is blank in some cells the DataTbl has the column but never gets any data for the column. In the following illustration:

New Applied Margin Rate Previous Applied Margin Rate Percentage Change Tier New Discount rate
16,800 16,800 0.00% 100%
16,800 16,800 0.00% 100%
59,850 59,850 0.00% 1 100%
52,070 52,070 0.00% 2 87%
52,070 52,070 0.00% 3 87%
59,850 59,850 0.00% 4 100%
59,850 59,850 0.00% 5 100%

Is an Excel file. The DataTbl never gets any data for the “Tier” column apparently because the first data cell is blank. If I put any character in this cell it reads the file fine. Strangely, if I delete a first data cell in other columns, New Scanning Range for example, the remaining data reads fine. It’s not a cell formatting issue – I tested that several ways. I’ve spent some time web searching and haven’t found any solutions. Any clues on how to fix this?
QuestionWhat is faster? C# or C++ Pin
Tomerland30-Oct-07 6:34
Tomerland30-Oct-07 6:34 
AnswerRe: What is faster? C# or C++ Pin
led mike30-Oct-07 6:40
led mike30-Oct-07 6:40 
AnswerRe: What is faster? C# or C++ Pin
Thomas Stockwell30-Oct-07 12:05
professionalThomas Stockwell30-Oct-07 12:05 
AnswerRe: What is faster? C# or C++ Pin
MohammadAmiry30-Oct-07 19:01
MohammadAmiry30-Oct-07 19:01 
GeneralRe: What is faster? C# or C++ Pin
led mike31-Oct-07 9:36
led mike31-Oct-07 9:36 
QuestionHow to assign a ref parameter to static ref variable so that another function can change it? Pin
elastic_vipin30-Oct-07 5:22
elastic_vipin30-Oct-07 5:22 
AnswerRe: How to assign a ref parameter to static ref variable so that another function can change it? Pin
Andrei Ungureanu30-Oct-07 5:38
Andrei Ungureanu30-Oct-07 5:38 
AnswerRe: How to assign a ref parameter to static ref variable so that another function can change it? Pin
Guffa30-Oct-07 6:59
Guffa30-Oct-07 6:59 
GeneralRe: How to assign a ref parameter to static ref variable so that another function can change it? Pin
elastic_vipin30-Oct-07 21:37
elastic_vipin30-Oct-07 21:37 
QuestionAccessing Web Applications DLL methods Pin
totocaster30-Oct-07 5:00
totocaster30-Oct-07 5:00 
AnswerRe: Accessing Web Applications DLL methods Pin
Eduard Keilholz30-Oct-07 5:13
Eduard Keilholz30-Oct-07 5:13 
AnswerRe: Accessing Web Applications DLL methods Pin
Andrei Ungureanu30-Oct-07 5:15
Andrei Ungureanu30-Oct-07 5:15 
QuestionCaching or what? Pin
Dextter30-Oct-07 4:31
Dextter30-Oct-07 4:31 
AnswerRe: Caching or what? Pin
led mike30-Oct-07 5:10
led mike30-Oct-07 5:10 
GeneralRe: Caching or what? Pin
Pete O'Hanlon30-Oct-07 6:06
mvePete O'Hanlon30-Oct-07 6:06 
QuestionBackground sql connection Pin
ev00l30-Oct-07 4:21
ev00l30-Oct-07 4:21 
AnswerRe: Background sql connection Pin
Christian Wikander30-Oct-07 4:44
Christian Wikander30-Oct-07 4:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.