Click here to Skip to main content
15,905,144 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to get out from the outer for Pin
Xmen Real 17-Mar-09 3:00
professional Xmen Real 17-Mar-09 3:00 
GeneralRe: how to get out from the outer for Pin
Pete O'Hanlon17-Mar-09 3:29
mvePete O'Hanlon17-Mar-09 3:29 
GeneralRe: how to get out from the outer for Pin
Xmen Real 17-Mar-09 3:35
professional Xmen Real 17-Mar-09 3:35 
GeneralRe: how to get out from the outer for Pin
Pete O'Hanlon17-Mar-09 3:42
mvePete O'Hanlon17-Mar-09 3:42 
GeneralRe: how to get out from the outer for Pin
Eddy Vluggen17-Mar-09 6:04
professionalEddy Vluggen17-Mar-09 6:04 
Questionhow can i change the sample rate and sample size of wave files Pin
ahmedhassan9617-Mar-09 0:12
ahmedhassan9617-Mar-09 0:12 
QuestionVS 2008 - Setup project: Change Link Icon in Program Menu Pin
dj_jeff17-Mar-09 0:10
dj_jeff17-Mar-09 0:10 
Questionhow to catch these events? Pin
abhiram_nayan17-Mar-09 0:01
abhiram_nayan17-Mar-09 0:01 
AnswerRe: how to catch these events? Pin
Eddy Vluggen17-Mar-09 0:50
professionalEddy Vluggen17-Mar-09 0:50 
GeneralRe: how to catch these events? Pin
abhiram_nayan17-Mar-09 1:02
abhiram_nayan17-Mar-09 1:02 
GeneralRe: how to catch these events? Pin
Eddy Vluggen17-Mar-09 1:41
professionalEddy Vluggen17-Mar-09 1:41 
QuestionWhat's name of this code ? Pin
Mohammad Dayyan16-Mar-09 23:28
Mohammad Dayyan16-Mar-09 23:28 
AnswerRe: What's name of this code ? Pin
DaveyM6916-Mar-09 23:30
professionalDaveyM6916-Mar-09 23:30 
Questionopenfiledialog Pin
abu anas alazuneh16-Mar-09 23:06
abu anas alazuneh16-Mar-09 23:06 
AnswerRe: openfiledialog Pin
SeMartens16-Mar-09 23:07
SeMartens16-Mar-09 23:07 
AnswerRe: openfiledialog Pin
Christian Graus16-Mar-09 23:08
protectorChristian Graus16-Mar-09 23:08 
AnswerRe: openfiledialog Pin
iamalik16-Mar-09 23:31
professionaliamalik16-Mar-09 23:31 
AnswerRe: openfiledialog Pin
Xmen Real 17-Mar-09 0:00
professional Xmen Real 17-Mar-09 0:00 
QuestionHow to get "Name" or any ther property of the virtual SerialPort Pin
Suun16-Mar-09 22:18
Suun16-Mar-09 22:18 
AnswerRe: How to get "Name" or any ther property of the virtual SerialPort Pin
Christian Graus16-Mar-09 22:52
protectorChristian Graus16-Mar-09 22:52 
AnswerRe: How to get "Name" or any ther property of the virtual SerialPort Pin
Xmen Real 16-Mar-09 22:57
professional Xmen Real 16-Mar-09 22:57 
Questionupload excel from local drive Pin
Mangesh Tomar16-Mar-09 22:17
Mangesh Tomar16-Mar-09 22:17 
Hi ,

Anybody please help me in this ..it is an urgent for me.

i am trying to fetch excel workbook dynamically but i am not get any idea about how to create an excel sheet object who help me for uploading the excel file dynamically using fileupload dialog box.

Here is my coad


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Office.Core ;
using System.Data.OleDb;
using Excel;
using System.Reflection;
using Microsoft.Office.Tools.Excel;

namespace WindowsApplication2
{
public partial class Form1 : Form
{
Excel.Workbook wb;
Excel.Worksheet ws;
public Form1()
{
InitializeComponent();
// wb = new Excel.Workbook();
//ws = new Excel.Worksheet();
}
// string filename = @"C:\tmp\SpreadsheetGearOleDbBenchmark.xls";

private void button1_Click(object sender, EventArgs e)
{
string filename = @"C:\abc.xls

String connectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + filename + ";" +
"Extended Properties=Excel 8.0;";
OleDbConnection connection = new OleDbConnection(connectionString);
connection.Open();
//String connectionString="Provider=Microsoft.Jet.OLEDB.4.0;"+"Data Source="+filename +";"+"Extended Properties=Excel 8.0;";
OleDbCommand selectCommand = new OleDbCommand ("SELECT * FROM [sheet1$]", connection);
OleDbDataAdapter dataAdapter = new OleDbDataAdapter();
dataAdapter.SelectCommand = selectCommand;
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet);


// double sum = 0.0;
// We'll make some assumptions for brevity of the code.
System.Data.DataTable dataTable = dataSet.Tables[0];
dataGridView1.DataSource = dataSet.Tables[0];
MessageBox.Show(dataGridView1.RowCount.ToString());

connection.Close();
openFileDialog1.ShowDialog();
//openFileDialog1.ShowDialog();

// return sum;
// directorySearcher1.FindAll();
}

private void Form1_Load(object sender, EventArgs e)
{


}

private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
{
openFileDialog1.ShowDialog();
Excel.Application excel = new Excel.Application();
}


}
}
AnswerRe: upload excel from local drive Pin
Greg Chelstowski16-Mar-09 22:53
Greg Chelstowski16-Mar-09 22:53 
GeneralRe: upload excel from local drive Pin
Mangesh Tomar16-Mar-09 23:34
Mangesh Tomar16-Mar-09 23:34 
GeneralRe: upload excel from local drive Pin
Mangesh Tomar17-Mar-09 0:24
Mangesh Tomar17-Mar-09 0:24 

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.