Click here to Skip to main content
15,912,069 members
Home / Discussions / C#
   

C#

 
AnswerRe: Chang color of particular string in Rich text Pin
Xmen Real 16-Mar-09 20:55
professional Xmen Real 16-Mar-09 20:55 
Questionhow to upload excelworkbook dynamically using c# Pin
Mangesh Tomar16-Mar-09 18:25
Mangesh Tomar16-Mar-09 18:25 
hi here is my code in this i give the file name and sheet name and display the sheet in gride but my client want to open any excel file dynamically. Need a help,



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();
}


private void button1_Click(object sender, EventArgs e)
{
string filename = @"C:\mangesh1\mor\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);

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();
}


}
}
QuestionHow to connect HTTPS server and download a file using C# , C# webclient Pin
Member 339828416-Mar-09 18:09
Member 339828416-Mar-09 18:09 
Questiondatagrid combobox windows Pin
sydney12316-Mar-09 17:43
sydney12316-Mar-09 17:43 
AnswerRe: datagrid combobox windows Pin
Xmen Real 16-Mar-09 20:30
professional Xmen Real 16-Mar-09 20:30 
QuestionHow to get MSIHANDLE Pin
Dracula Wang16-Mar-09 17:34
Dracula Wang16-Mar-09 17:34 
AnswerRe: How to get MSIHANDLE Pin
Christian Graus16-Mar-09 18:22
protectorChristian Graus16-Mar-09 18:22 
AnswerRe: How to get MSIHANDLE Pin
0x3c016-Mar-09 22:03
0x3c016-Mar-09 22:03 
QuestionAbsolute coordinates of a control or relative coordinates of the mouse Pin
User 58385216-Mar-09 17:01
User 58385216-Mar-09 17:01 
AnswerRe: Absolute coordinates of a control or relative coordinates of the mouse Pin
Christian Graus16-Mar-09 18:54
protectorChristian Graus16-Mar-09 18:54 
Questionupdate server DB from local Dataset via XML Pin
dingo1416-Mar-09 15:58
dingo1416-Mar-09 15:58 
AnswerRe: update server DB from local Dataset via XML Pin
Xmen Real 16-Mar-09 16:16
professional Xmen Real 16-Mar-09 16:16 
GeneralRe: update server DB from local Dataset via XML Pin
dingo1416-Mar-09 16:43
dingo1416-Mar-09 16:43 
GeneralRe: update server DB from local Dataset via XML Pin
Xmen Real 16-Mar-09 22:47
professional Xmen Real 16-Mar-09 22:47 
AnswerRe: update server DB from local Dataset via XML Pin
dingo1417-Mar-09 9:01
dingo1417-Mar-09 9:01 
QuestionChange my O2 Zinc to COM Port Pin
Aghosh Babu16-Mar-09 15:25
Aghosh Babu16-Mar-09 15:25 
QuestionDSOFile Problem.....??? (Summery Info) [modified] Pin
S K Y16-Mar-09 15:04
S K Y16-Mar-09 15:04 
AnswerRe: DSOFile Problem.....??? (Summery Info) Pin
Mycroft Holmes16-Mar-09 15:56
professionalMycroft Holmes16-Mar-09 15:56 
QuestionThreading Question - Object in AsyncCompletedEventArgs Pin
Jammer16-Mar-09 14:05
Jammer16-Mar-09 14:05 
QuestionButton to scroll MDI Parent FOrm [modified] Pin
jameschristianii16-Mar-09 11:54
jameschristianii16-Mar-09 11:54 
QuestionObject Wrapping and Event Subscription Pin
Jammer16-Mar-09 11:28
Jammer16-Mar-09 11:28 
AnswerRe: Object Wrapping and Event Subscription Pin
Christian Graus16-Mar-09 12:37
protectorChristian Graus16-Mar-09 12:37 
GeneralRe: Object Wrapping and Event Subscription Pin
Jammer16-Mar-09 12:41
Jammer16-Mar-09 12:41 
AnswerRe: Object Wrapping and Event Subscription Pin
DaveyM6916-Mar-09 12:49
professionalDaveyM6916-Mar-09 12:49 
QuestionHow to Refreash an array list Pin
soulidentities16-Mar-09 7:40
soulidentities16-Mar-09 7:40 

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.