Click here to Skip to main content
16,010,334 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to Browse my Basic .aspx file with HTTPS insted HTTP Pin
The Man from U.N.C.L.E.9-Nov-09 7:50
The Man from U.N.C.L.E.9-Nov-09 7:50 
QuestionGDI question ? Pin
Mohammad Dayyan9-Nov-09 1:51
Mohammad Dayyan9-Nov-09 1:51 
AnswerRe: GDI question ? Pin
Luc Pattyn9-Nov-09 2:21
sitebuilderLuc Pattyn9-Nov-09 2:21 
GeneralRe: GDI question ? Pin
Mohammad Dayyan9-Nov-09 2:24
Mohammad Dayyan9-Nov-09 2:24 
GeneralRe: GDI question ? Pin
Luc Pattyn9-Nov-09 2:28
sitebuilderLuc Pattyn9-Nov-09 2:28 
AnswerRe: GDI question ? Pin
Hristo-Bojilov9-Nov-09 3:52
Hristo-Bojilov9-Nov-09 3:52 
QuestionRegarding Crystal report & Windows service? Pin
Tridip Bhattacharjee9-Nov-09 1:47
professionalTridip Bhattacharjee9-Nov-09 1:47 
QuestionReading xlsx file in C# returning blank value Pin
bensonbenadict9-Nov-09 1:13
bensonbenadict9-Nov-09 1:13 
Hi,

I have to read an xlsx file in which there are multiple columns. One of it is a 'Date' column type. I am using OLEDB with Microsoft.ACE.OLEDB.12.0 as the provider. The problem is, suppose if there is a non date value (Error data) in the column the oledb is replacing the error data with null. I have a requirement to show the all data (good data as well as the error) to user who is reading the excel file into our database.i.e. i dont wnt the engine to convert the value to null

When reading xls file,which can be done by using Microsoft.Jet.4.0 provider, we can overcome this by changing property of IMEX=1 and changing the 'Typeguessrows=1' in the registry. But unfortunately this provider cannot be used for reading an xlsx file.

Can anyone help me how to overcome this problem??? I have also listed down the code below which i am using for reading the file





DataSet ds = new DataSet();
            //Provider String Extended properties: 
            //"Excel 12.0": Use Excel (xls or xlsx) as source
            //"Header Yes": Header is included in the Excel sheet
            //"IMEX=1": When reading from the excel sheet ignore datatypes and read all data in the sheet.
            //Without setting IMEX=0, the excel reader looks for the datatype in the excel sheet.
            //The code below in comments was used for reading xls file
            //OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FileName + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"");
            // The code below is the one i am using for reading an xlsx file
            OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + FileName + ";Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1;MAXSCANROWS=0\"");
            con.Open();
            try
            {
                //Create Dataset and fill with imformation from the Excel Spreadsheet for easier reference
                DataTable dt = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
                string sheetname = dt.Rows[0]["TABLE_NAME"].ToString();

                OleDbDataAdapter myCommand = new OleDbDataAdapter(" SELECT * FROM [" + sheetname + "]", con);
                myCommand.Fill(ds);
                
            }
            catch (Exception ex)
            {
                string exce = ex.Message;
            }
            finally
            {
                con.Close();
            }
            return ds;

AnswerRe: Reading xlsx file in C# returning blank value Pin
Swetha S14-Jul-10 19:13
Swetha S14-Jul-10 19:13 
Questioni have problem with end of process Pin
E_Gold9-Nov-09 0:14
E_Gold9-Nov-09 0:14 
AnswerRe: i have problem with end of process Pin
Luc Pattyn9-Nov-09 0:27
sitebuilderLuc Pattyn9-Nov-09 0:27 
QuestionC# with instant messenger Pin
Levisaxos9-Nov-09 0:07
Levisaxos9-Nov-09 0:07 
AnswerRe: C# with instant messenger Pin
Levisaxos9-Nov-09 1:22
Levisaxos9-Nov-09 1:22 
QuestionSpeech Recognition Pin
krinaljariwala8-Nov-09 23:44
krinaljariwala8-Nov-09 23:44 
AnswerMessage Closed Pin
8-Nov-09 23:51
stancrm8-Nov-09 23:51 
GeneralRe: Speech Recognition Pin
krinaljariwala11-Nov-09 19:29
krinaljariwala11-Nov-09 19:29 
QuestionCreate autoplay bots Pin
merger1238-Nov-09 23:34
merger1238-Nov-09 23:34 
AnswerRe: Create autoplay bots Pin
LimitedAtonement9-Nov-09 7:31
LimitedAtonement9-Nov-09 7:31 
QuestionRe: Create autoplay bots Pin
merger1239-Nov-09 21:13
merger1239-Nov-09 21:13 
AnswerRe: Create autoplay bots Pin
LimitedAtonement10-Nov-09 4:19
LimitedAtonement10-Nov-09 4:19 
GeneralRe: Create autoplay bots Pin
merger12310-Nov-09 21:27
merger12310-Nov-09 21:27 
QuestionGetting the cells data when clicked on it in gridview asp.net Pin
sure_suresh8-Nov-09 23:27
sure_suresh8-Nov-09 23:27 
Questionabout treeview, Pin
miss YY8-Nov-09 22:35
miss YY8-Nov-09 22:35 
AnswerRe: about treeview, Pin
Luc Pattyn8-Nov-09 23:16
sitebuilderLuc Pattyn8-Nov-09 23:16 
AnswerRe: about treeview, Pin
Shameel8-Nov-09 23:41
professionalShameel8-Nov-09 23:41 

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.