Click here to Skip to main content
15,888,293 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am importing data from excel file to dataset but it gives me above exception

below is my code

DataSet ds = o_Cls_Utility.ReadExcelToDataSet(FilePath, "Input file - DASHBOARD", "TotalCash", false);


VB
double[] dAlertLevel = (from row in ds.Tables[0].AsEnumerable()
                        select Convert.ToDouble(row["AlertLevel"])).ToArray();

string[] strSquareOffMode = ds.Tables[0]
                           .AsEnumerable()
                           .Select(row => row.Field<string>("SquareOffMode").Trim())
                           .ToArray();


for strSquareOffMode it gives the above exception .
below is store procedure.


SQL
CREATE OR REPLACE PROCEDURE SP_INTRADAY_FNODASHBRD_IMP
(

      sClientCode IN   VARCHAR2,
      sClientName IN   VARCHAR2,

      sSquareOffMode            IN   VARCHAR2,
      sM2M_BPL                  IN   FLOAT,
      nEximID   IN   NUMBER

  )
is

Insert into INTRADAY_FNODASHBRD_IMP (ID, .... ,SQUAREOFFMODE
,M2M_BPL, EXIM_ID)
VALUES ( INTRADAYCASH..... ,
SQL
sSquareOffMode       ,      sM2M_BPL ,   nEximID);

 COMMIT;
end;


begin
Posted
Comments
Thomas ktg 24-Sep-13 8:40am    
what is the value of SquareOffMode in Excel?
Member 9410081 25-Sep-13 2:09am    
FALSE
Richard MacCutchan 8-Oct-13 10:43am    
You really need to sit down with your reference documents and spend some proper time studying the subjects you are working with, rather than trying to learn them by posting questions here.

1 solution

You can fix it by not trying to cast unrelated types. Instead of using System.Boolean.ToString, use Boolean, if you even need to:
http://msdn.microsoft.com/en-us/library/system.boolean.aspx[^].

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900