Click here to Skip to main content
15,924,935 members
Home / Discussions / C#
   

C#

 
GeneralRe: filtered error Pin
leppie7-Aug-04 23:02
leppie7-Aug-04 23:02 
GeneralPointers, Objects, Classes ... Pin
Tambi Ashmoz7-Aug-04 20:36
Tambi Ashmoz7-Aug-04 20:36 
GeneralRe: Pointers, Objects, Classes ... Pin
leppie7-Aug-04 23:29
leppie7-Aug-04 23:29 
GeneralRe: Pointers, Objects, Classes ... Pin
t3rmin4t0r8-Aug-04 1:50
t3rmin4t0r8-Aug-04 1:50 
GeneralRe: Pointers, Objects, Classes ... Pin
softp_vc8-Aug-04 18:50
softp_vc8-Aug-04 18:50 
General.net help for mobole computing Pin
happyshub7-Aug-04 20:36
happyshub7-Aug-04 20:36 
QuestionHow to set display of a column according to its value in DataGrid? Pin
mkomasi7-Aug-04 20:02
mkomasi7-Aug-04 20:02 
GeneralAccessing multiple Excel files Pin
janigorse7-Aug-04 19:03
janigorse7-Aug-04 19:03 
I'm working on application, that will recive multiple Excel files
and displaing it in a DataGrid.

The problem is, that when I select 2 or 3 files from OpenDialog, it
displays only the data from the first selected file, the other values
in DataGrid are null values. Why is that? And how can I solve this, that
the DataGrid will display all values. Thank you.

Here is the code:
private void btnOpen_Click(object sender, System.EventArgs e)
{
try
{
Stream myStream;
OpenFileDialog openFileDialog1 = new OpenFileDialog();
// set up file dialog properties
openFileDialog1.InitialDirectory = "E:\\" ;
openFileDialog1.Filter = "txt files (*.txt)|*.txt|Allfiles(*.*)|*.*" ;
openFileDialog1.FilterIndex = 2 ;
openFileDialog1.RestoreDirectory = true ;
openFileDialog1.Multiselect = true;

if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
if((myStream = openFileDialog1.OpenFile())!= null)
{
// Insert code to read the stream here.
// string strFileName = openFileDialog1.FileName;
DataSet ds = new DataSet();

foreach (string strFileName in openFileDialog1.FileNames)
{

string connStr = 
@"Driver={Microsoft Excel Driver (*.xls)};DBQ=" + strFileName;

string sql = "SELECT * FROM [Sheet1$]";
OdbcDataAdapter adapter = new OdbcDataAdapter(sql,connStr);
adapter.Fill(ds,"[Sheet1$]");

}
gridPorocila.DataMember = "[Sheet1$]";
gridPorocila.DataSource = ds.DefaultViewManager;

myStream.Close();
}
}

}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}

} 

GeneralHelp with c# Pin
Tom Dziedzic7-Aug-04 16:49
Tom Dziedzic7-Aug-04 16:49 
GeneralRe: Help with c# Pin
Tom Dziedzic7-Aug-04 17:12
Tom Dziedzic7-Aug-04 17:12 
GeneralRe: Help with c# Pin
Tom Dziedzic7-Aug-04 17:19
Tom Dziedzic7-Aug-04 17:19 
GeneralRe: Help with c# Pin
Paul Lyons7-Aug-04 17:40
Paul Lyons7-Aug-04 17:40 
GeneralRe: Help with c# Pin
Tom Dziedzic7-Aug-04 17:44
Tom Dziedzic7-Aug-04 17:44 
GeneralRe: Help with c# Pin
Tom Dziedzic7-Aug-04 17:54
Tom Dziedzic7-Aug-04 17:54 
GeneralRe: Help with c# Pin
DougW487-Aug-04 19:36
DougW487-Aug-04 19:36 
GeneralRe: Help with c# Pin
leppie7-Aug-04 23:37
leppie7-Aug-04 23:37 
GeneralRe: Help with c# Pin
DougW488-Aug-04 6:52
DougW488-Aug-04 6:52 
GeneralRe: Help with c# Pin
Tom Dziedzic8-Aug-04 6:02
Tom Dziedzic8-Aug-04 6:02 
GeneralRe: Help with c# Pin
Tom Dziedzic8-Aug-04 6:31
Tom Dziedzic8-Aug-04 6:31 
GeneralInvalidCastException with CAPICOM and webServices Pin
Escroto7-Aug-04 12:50
Escroto7-Aug-04 12:50 
GeneralRe: InvalidCastException with CAPICOM and webServices Pin
Alex Korchemniy7-Aug-04 13:09
Alex Korchemniy7-Aug-04 13:09 
GeneralRe: InvalidCastException with CAPICOM and webServices Pin
beowulfagate7-Aug-04 16:55
beowulfagate7-Aug-04 16:55 
GeneralReplace Task Manager Pin
mrtaikandi7-Aug-04 2:08
professionalmrtaikandi7-Aug-04 2:08 
GeneralRe: Replace Task Manager Pin
Alex Korchemniy7-Aug-04 13:04
Alex Korchemniy7-Aug-04 13:04 
GeneralExecuting an external application Pin
mrtaikandi7-Aug-04 2:00
professionalmrtaikandi7-Aug-04 2:00 

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.