Click here to Skip to main content
15,911,646 members
Home / Discussions / C#
   

C#

 
QuestionDatabase Explorer Query Pin
mauricemcse9-Apr-12 12:38
mauricemcse9-Apr-12 12:38 
AnswerRe: Database Explorer Query Pin
PIEBALDconsult9-Apr-12 14:27
mvePIEBALDconsult9-Apr-12 14:27 
GeneralRe: Database Explorer Query Pin
mauricemcse9-Apr-12 16:25
mauricemcse9-Apr-12 16:25 
GeneralRe: Database Explorer Query Pin
Richard MacCutchan9-Apr-12 21:09
mveRichard MacCutchan9-Apr-12 21:09 
AnswerRe: Database Explorer Query Pin
Dave Kreskowiak9-Apr-12 14:40
mveDave Kreskowiak9-Apr-12 14:40 
GeneralGetting Higlighted/Selected Text in C# Pin
Alchemist28899-Apr-12 0:06
Alchemist28899-Apr-12 0:06 
GeneralRe: Getting Higlighted/Selected Text in C# Pin
Bernhard Hiller9-Apr-12 23:36
Bernhard Hiller9-Apr-12 23:36 
Questionimporting RowName and ColumnName from an excelfile to a datagridview ... Pin
nassimnastaran8-Apr-12 8:39
nassimnastaran8-Apr-12 8:39 
Hi All !
I want to Import an Excel File to a DataGridView as FirstRow (Except A1 Cell that's null)will be Column HeaderCell in DataGridView and First Column in Excel file (Except Cell of A1=null) will be Row HeaderCell in DataGridView .Here is my code :

string connectionString = String.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0;HDR=YES;IMEX=1;""", openFileDialog1.FileName);
string query = String.Format("select * from [{0}$]", SheetName);
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, connectionString);

DataSet ds = new DataSet();

dataAdapter.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];

int row = ds.Tables[0].Rows.Count;
int col = ds.Tables[0].Columns.Count;

for (int i = 0; i < row - 1; i++)
{
  dataGridView1.Rows[i].HeaderCell.Value = ds.Tables[0].Rows[i].ToString(); ;
}

for (int j = 0; j < col - 1; j++)
{
  dataGridView1.Columns[j].HeaderCell.Value = ds.Tables[0].Columns[j].ToString();
}

But I have some Problem for Header Column And Header Row .
Thanks For Any Help .
AnswerRe: importing RowName and ColumnName from an excelfile to a datagridview ... Pin
Mycroft Holmes8-Apr-12 20:54
professionalMycroft Holmes8-Apr-12 20:54 
GeneralRe: importing RowName and ColumnName from an excelfile to a datagridview ... Pin
nassimnastaran9-Apr-12 4:18
nassimnastaran9-Apr-12 4:18 
QuestionDatabase Programming in WPF Pin
TAN TH7-Apr-12 23:10
TAN TH7-Apr-12 23:10 
AnswerRe: Database Programming in WPF Pin
Mycroft Holmes8-Apr-12 0:07
professionalMycroft Holmes8-Apr-12 0:07 
GeneralRe: Database Programming in WPF Pin
TAN TH8-Apr-12 20:32
TAN TH8-Apr-12 20:32 
GeneralRe: Database Programming in WPF Pin
Mycroft Holmes8-Apr-12 20:50
professionalMycroft Holmes8-Apr-12 20:50 
GeneralRe: Database Programming in WPF Pin
TAN TH9-Apr-12 13:56
TAN TH9-Apr-12 13:56 
Questionaccessing image by bit in c # Pin
waqar rashid7-Apr-12 21:56
waqar rashid7-Apr-12 21:56 
AnswerRe: accessing image by bit in c # Pin
Pete O'Hanlon7-Apr-12 22:49
mvePete O'Hanlon7-Apr-12 22:49 
GeneralRe: accessing image by bit in c # Pin
Vipin_Arora8-Apr-12 21:36
Vipin_Arora8-Apr-12 21:36 
Questionlog into a website Pin
DanYELL7-Apr-12 8:15
DanYELL7-Apr-12 8:15 
AnswerRe: log into a website Pin
Not Active7-Apr-12 11:08
mentorNot Active7-Apr-12 11:08 
GeneralRe: log into a website Pin
DanYELL7-Apr-12 13:47
DanYELL7-Apr-12 13:47 
GeneralRe: log into a website Pin
DanYELL9-Apr-12 3:46
DanYELL9-Apr-12 3:46 
QuestionGetting values from tasklist.exe /v Pin
CCodeNewbie7-Apr-12 6:24
CCodeNewbie7-Apr-12 6:24 
AnswerRe: Getting values from tasklist.exe /v Pin
Richard Andrew x647-Apr-12 6:42
professionalRichard Andrew x647-Apr-12 6:42 
GeneralRe: Getting values from tasklist.exe /v Pin
CCodeNewbie7-Apr-12 6:55
CCodeNewbie7-Apr-12 6:55 

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.