Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: upload excel from local drive Pin
Greg Chelstowski17-Mar-09 0:46
Greg Chelstowski17-Mar-09 0:46 
QuestionFixed columns in DataGridview in windows C# Pin
Rami.P16-Mar-09 21:49
Rami.P16-Mar-09 21:49 
AnswerRe: Fixed columns in DataGridview in windows C# Pin
Spunky Coder16-Mar-09 22:24
Spunky Coder16-Mar-09 22:24 
GeneralRe: Fixed columns in DataGridview in windows C# Pin
Rami.P16-Mar-09 22:43
Rami.P16-Mar-09 22:43 
GeneralRe: Fixed columns in DataGridview in windows C# Pin
Xmen Real 16-Mar-09 22:54
professional Xmen Real 16-Mar-09 22:54 
GeneralRe: Fixed columns in DataGridview in windows C# [modified] Pin
Spunky Coder16-Mar-09 23:13
Spunky Coder16-Mar-09 23:13 
GeneralRe: Fixed columns in DataGridview in windows C# Pin
Rami.P17-Mar-09 0:00
Rami.P17-Mar-09 0:00 
QuestionClose a Child Form Pin
yesu prakash16-Mar-09 21:05
yesu prakash16-Mar-09 21:05 
AnswerRe: Close a Child Form Pin
Xmen Real 16-Mar-09 21:15
professional Xmen Real 16-Mar-09 21:15 
AnswerRe: Close a Child Form Pin
12Code16-Mar-09 22:02
12Code16-Mar-09 22:02 
AnswerRe: Close a Child Form Pin
jaypatel51217-Mar-09 7:20
jaypatel51217-Mar-09 7:20 
QuestionSocket Exception "An address incompatible with the requested protocol was used" on Vista Pin
niharshukla16-Mar-09 20:50
niharshukla16-Mar-09 20:50 
AnswerRe: Socket Exception "An address incompatible with the requested protocol was used" on Vista Pin
Xmen Real 16-Mar-09 21:17
professional Xmen Real 16-Mar-09 21:17 
QuestionFile Not Getting Imported (Black Magic) Pin
Sandeep Kalra16-Mar-09 20:48
Sandeep Kalra16-Mar-09 20:48 

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.