Click here to Skip to main content
15,881,757 members
Home / Discussions / C#
   

C#

 
Questionvertical align in richtextbox Pin
Cuciu12-Aug-07 21:38
Cuciu12-Aug-07 21:38 
Questionc# - Painting problem Pin
T.D.Prasad12-Aug-07 21:27
T.D.Prasad12-Aug-07 21:27 
AnswerRe: c# - Painting problem Pin
Albu Marius12-Aug-07 22:31
Albu Marius12-Aug-07 22:31 
AnswerRe: c# - Painting problem Pin
Cuciu12-Aug-07 22:42
Cuciu12-Aug-07 22:42 
QuestionRe: c# - Painting problem Pin
T.D.Prasad12-Aug-07 23:51
T.D.Prasad12-Aug-07 23:51 
AnswerRe: c# - Painting problem Pin
Christian Graus13-Aug-07 0:31
protectorChristian Graus13-Aug-07 0:31 
AnswerRe: c# - Painting problem Pin
Christian Graus12-Aug-07 23:52
protectorChristian Graus12-Aug-07 23:52 
QuestionReading Numeric and AlphaNumeric Values from Excel Pin
meeram39512-Aug-07 20:10
meeram39512-Aug-07 20:10 
Hi

I have an Excel sheet, has 4 columns. In the first column there is an industry code, which contains both numeric and alphanumeric chararcters. I'm not able to read the values to the dataset if the value is alphabets. For eg. if the value is 1,2,3,4 etc.. it will read. But if the value is 1a, 2b, 3e, 4d etc. then it will read as null. Anybody has any solution for these? Any help would be great. I'll post my code below:

OleDbCommand MyCommand;
OleDbConnection MyConnection;

MyConnection = new OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source=C:\\Projects\\LiquidCreditChains\\CreditCurveMapping.xls;Extended Properties=Excel 8.0;");

if (MyConnection.State != ConnectionState.Closed)
MyConnection.Close();
else
MyConnection.Open();

DataTable dtSector = new DataTable("SectorChains");
objds.Tables.Add(dtSector);

DataColumn dc1 = new DataColumn("Indust_Code");
dc1.DataType = System.Type.GetType("System.String");
dtSector.Columns.Add(dc1);
DataColumn dc2 = new DataColumn("Indust_Number");
dc2.DataType = System.Type.GetType("System.Int64");
dtSector.Columns.Add(dc2);
DataColumn dc3 = new DataColumn("MappingDescription");
dc3.DataType = System.Type.GetType("System.String");
dtSector.Columns.Add(dc3);
DataColumn dc4 = new DataColumn("SubDescription");
dc4.DataType = System.Type.GetType("System.String");
dtSector.Columns.Add(dc4);
DataColumn dc5 = new DataColumn("Mapping_Curve");
dc5.DataType = System.Type.GetType("System.String");
dtSector.Columns.Add(dc5);

MyCommand = new OleDbCommand("select * from [Sheet1$]", MyConnection);
OleDbDataReader dr1 = MyCommand.ExecuteReader();

while (dr1.Read())
{

DataRow newChainRow = objds.Tables[0].NewRow();

newChainRow["Indust_Code"] = dr1[0].ToString();
newChainRow["Indust_Number"]=dr1[1].ToString();
newChainRow["MappingDescription"] = dr1[2].ToString();
newChainRow["SubDescription"]= dr1[3].ToString();
newChainRow["Mapping_Curve"] = dr1[4].ToString();
objds.Tables[0].Rows.Add(newChainRow);
}

Any help in this regard would be great!!

Thanks

Meeram395

AnswerRe: Reading Numeric and AlphaNumeric Values from Excel Pin
travlos718-Mar-09 6:14
travlos718-Mar-09 6:14 
AnswerRe: Reading Numeric and AlphaNumeric Values from Excel Pin
InfoBridgeSolutions17-Aug-10 19:30
InfoBridgeSolutions17-Aug-10 19:30 
QuestionDatagrid paging-c# windows application Pin
hemchandars12-Aug-07 20:06
hemchandars12-Aug-07 20:06 
AnswerRe: Datagrid paging-c# windows application Pin
Jax_qqq12-Aug-07 21:41
Jax_qqq12-Aug-07 21:41 
GeneralRe: Datagrid paging-c# windows application Pin
hemchandars13-Aug-07 1:03
hemchandars13-Aug-07 1:03 
Questionhow to Read folder contents [modified] Pin
salmonraju12-Aug-07 20:05
salmonraju12-Aug-07 20:05 
AnswerRe: how to Read folder contents Pin
Michael Sync12-Aug-07 20:18
Michael Sync12-Aug-07 20:18 
GeneralRe: how to Read folder contents Pin
salmonraju12-Aug-07 21:02
salmonraju12-Aug-07 21:02 
AnswerRe: how to Read folder contents Pin
tker12-Aug-07 20:29
tker12-Aug-07 20:29 
GeneralRe: how to Read folder contents Pin
salmonraju12-Aug-07 21:01
salmonraju12-Aug-07 21:01 
Questioncrystal reports Pin
monuSaini12-Aug-07 19:58
monuSaini12-Aug-07 19:58 
AnswerRe: crystal reports Pin
Imranlogi12-Aug-07 20:33
Imranlogi12-Aug-07 20:33 
GeneralRe: crystal reports Pin
monuSaini12-Aug-07 20:49
monuSaini12-Aug-07 20:49 
GeneralRe: crystal reports Pin
Imranlogi12-Aug-07 21:18
Imranlogi12-Aug-07 21:18 
GeneralRe: crystal reports Pin
monuSaini12-Aug-07 21:27
monuSaini12-Aug-07 21:27 
GeneralRe: crystal reports Pin
Imranlogi12-Aug-07 23:06
Imranlogi12-Aug-07 23:06 
QuestionObject reference problem in a windows application. Pin
Janu_M12-Aug-07 19:23
Janu_M12-Aug-07 19:23 

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.