Click here to Skip to main content
15,902,938 members
Home / Discussions / C#
   

C#

 
GeneralRe: c# API to handle Microsoft word document file format Pin
Paul Conrad8-Aug-08 12:17
professionalPaul Conrad8-Aug-08 12:17 
GeneralRe: c# API to handle Microsoft word document file format Pin
Christian Graus8-Aug-08 16:58
protectorChristian Graus8-Aug-08 16:58 
GeneralRe: c# API to handle Microsoft word document file format Pin
Paul Conrad8-Aug-08 19:31
professionalPaul Conrad8-Aug-08 19:31 
GeneralRe: c# API to handle Microsoft word document file format Pin
Miss_hacker8-Aug-08 20:37
Miss_hacker8-Aug-08 20:37 
GeneralRe: c# API to handle Microsoft word document file format Pin
Cruel Handsome22-Aug-08 2:41
Cruel Handsome22-Aug-08 2:41 
GeneralRe: c# API to handle Microsoft word document file format Pin
Miss_hacker22-Aug-08 3:31
Miss_hacker22-Aug-08 3:31 
Questionpaste possibility Pin
netJP12L8-Aug-08 9:28
netJP12L8-Aug-08 9:28 
QuestionIndexOutOfRangeException - DbCommand / DbDataReader numeric column name Pin
dataminers8-Aug-08 9:18
dataminers8-Aug-08 9:18 
I read excel file using following code. This code properly work when columnName variable is not numeric value. If columnName varibale is numeric for example columnName = "1"; so I get IndexOutOfRangeException. Under the while loop, in this line myList.Add(dr[columnName].ToString());

//columnName is string parameter

string connectionString = "....."
List<string> myList = new List<string>();
DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.OleDb");

using (DbConnection connection = factory.CreateConnection())
{
connection.ConnectionString = connectionString;
using (DbCommand command = connection.CreateCommand())
{
string sql = "SELECT " + columnName + " FROM [Test$]";
command.CommandText = sql;
connection.Open();
using (DbDataReader dr = command.ExecuteReader())
{
while (dr.Read())
{
myList.Add(dr[columnName].ToString());
}
dr.Close();
}
}
}

What can I do.
Best Regards...
AnswerRe: IndexOutOfRangeException - DbCommand / DbDataReader numeric column name Pin
Guffa8-Aug-08 9:38
Guffa8-Aug-08 9:38 
GeneralRe: IndexOutOfRangeException - DbCommand / DbDataReader numeric column name Pin
dataminers8-Aug-08 22:13
dataminers8-Aug-08 22:13 
Questionfilewatcher to invoke servcie after a file is fully copied Pin
balu123458-Aug-08 8:12
balu123458-Aug-08 8:12 
Questionfile Copy from system to another system in C#.net Pin
balu123458-Aug-08 8:02
balu123458-Aug-08 8:02 
AnswerRe: file Copy from system to another system in C#.net Pin
vikas amin8-Aug-08 9:38
vikas amin8-Aug-08 9:38 
GeneralRe: file Copy from system to another system in C#.net Pin
balu123458-Aug-08 20:44
balu123458-Aug-08 20:44 
QuestionError message Pin
netJP12L8-Aug-08 6:16
netJP12L8-Aug-08 6:16 
AnswerRe: Error message Pin
Gareth H8-Aug-08 6:22
Gareth H8-Aug-08 6:22 
AnswerRe: Error message Pin
hammerstein058-Aug-08 6:30
hammerstein058-Aug-08 6:30 
GeneralRe: Error message Pin
netJP12L8-Aug-08 6:39
netJP12L8-Aug-08 6:39 
GeneralRe: Error message Pin
astanton19788-Aug-08 6:46
astanton19788-Aug-08 6:46 
AnswerRe: Error message Pin
Wendelius8-Aug-08 6:46
mentorWendelius8-Aug-08 6:46 
GeneralRe: Error message Pin
netJP12L8-Aug-08 7:16
netJP12L8-Aug-08 7:16 
GeneralRe: Error message Pin
Wendelius8-Aug-08 7:28
mentorWendelius8-Aug-08 7:28 
GeneralRe: Error message........Thankssssssssssss Pin
netJP12L8-Aug-08 8:44
netJP12L8-Aug-08 8:44 
GeneralRe: Error message........Thankssssssssssss Pin
Wendelius8-Aug-08 8:46
mentorWendelius8-Aug-08 8:46 
QuestionHow to run DOS attrib commands like +S, +R in my c# project? Pin
Member 28376158-Aug-08 5:20
Member 28376158-Aug-08 5:20 

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.