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

C#

 
GeneralRe: Convert PDF to Tiff Pin
dan!sh 21-Mar-09 3:09
professional dan!sh 21-Mar-09 3:09 
Questionperforming button click automatically without performing it Pin
sashidhar21-Mar-09 2:04
sashidhar21-Mar-09 2:04 
AnswerRe: performing button click automatically without performing it Pin
Ravi Mori21-Mar-09 3:36
Ravi Mori21-Mar-09 3:36 
AnswerRe: performing button click automatically without performing it Pin
DaveyM6921-Mar-09 9:33
professionalDaveyM6921-Mar-09 9:33 
QuestionConversion from ascii to unicode Pin
tauras8121-Mar-09 1:15
tauras8121-Mar-09 1:15 
AnswerRe: Conversion from ascii to unicode Pin
dan!sh 21-Mar-09 1:25
professional dan!sh 21-Mar-09 1:25 
AnswerRe: Conversion from ascii to unicode Pin
PIEBALDconsult21-Mar-09 4:39
mvePIEBALDconsult21-Mar-09 4:39 
Questionruntime error for oledb Pin
Mangesh Tomar21-Mar-09 1:13
Mangesh Tomar21-Mar-09 1:13 
HI here is my code i take 1 txt,1datagride,2 button,1 file dialog box .
on 1 button i open filedialog box select 1 excel file and fetch string in to txt box,and try to open this excel file in datagride view


WHEN I RUN MY PROGRAM A RUN TIME EXCEPTION THROWEN BY OLEDB IE,
Cannot update. Database or object is read-only.
PLZ HELP


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Data.OleDb;


namespace filedialog
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

}

private void button2_Click(object sender, EventArgs e)
{

string filename = @"textBox1.Text";
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 button3_Click(object sender, EventArgs e)
{
OpenFileDialog FD = new OpenFileDialog();

FD .Filter="Excel|*.xls";


if (FD.ShowDialog() == DialogResult.OK)
{
textBox1.Text = " " + FD.FileName;
}

}


}



}
AnswerRe: runtime error for oledb Pin
dan!sh 21-Mar-09 1:32
professional dan!sh 21-Mar-09 1:32 
AnswerRe: runtime error for oledb Pin
Eddy Vluggen21-Mar-09 2:25
professionalEddy Vluggen21-Mar-09 2:25 
QuestionRegular Expressions Pin
yadlaprasad20-Mar-09 23:49
yadlaprasad20-Mar-09 23:49 
AnswerRe: Regular Expressions Pin
dan!sh 21-Mar-09 1:09
professional dan!sh 21-Mar-09 1:09 
AnswerRe: Regular Expressions Pin
Michael Schubert21-Mar-09 2:45
Michael Schubert21-Mar-09 2:45 
AnswerRe: Regular Expressions Pin
PIEBALDconsult21-Mar-09 4:40
mvePIEBALDconsult21-Mar-09 4:40 
AnswerRe: Regular Expressions Pin
agent00zelda23-Mar-09 10:02
agent00zelda23-Mar-09 10:02 
Questionhelp me in this program Pin
Nettai20-Mar-09 22:48
Nettai20-Mar-09 22:48 
AnswerRe: help me in this program Pin
Xmen Real 20-Mar-09 23:02
professional Xmen Real 20-Mar-09 23:02 
AnswerRe: help me in this program Pin
Nettai20-Mar-09 23:40
Nettai20-Mar-09 23:40 
GeneralRe: help me in this program Pin
Xmen Real 21-Mar-09 1:30
professional Xmen Real 21-Mar-09 1:30 
AnswerRe: help me in this program Pin
dan!sh 21-Mar-09 1:21
professional dan!sh 21-Mar-09 1:21 
QuestionClient in C# Pin
mrithula820-Mar-09 21:38
mrithula820-Mar-09 21:38 
AnswerRe: Client in C# Pin
mrithula823-Mar-09 20:50
mrithula823-Mar-09 20:50 
QuestionRemote Desktop Monitoring Pin
sanju_thomas20-Mar-09 20:32
sanju_thomas20-Mar-09 20:32 
AnswerRe: Remote Desktop Monitoring Pin
Xmen Real 20-Mar-09 22:56
professional Xmen Real 20-Mar-09 22:56 
QuestionC#.windows application Problem Pin
varun.g20-Mar-09 20:22
varun.g20-Mar-09 20:22 

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.