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

C#

 
AnswerRe: MouseMove in a container Pin
Rafone19-Sep-08 6:50
Rafone19-Sep-08 6:50 
QuestionCan a template parameter be restricted to primitive types? Pin
HosamAly18-Sep-08 11:24
HosamAly18-Sep-08 11:24 
AnswerRe: Can a template parameter be restricted to primitive types? Pin
Pete O'Hanlon18-Sep-08 11:31
mvePete O'Hanlon18-Sep-08 11:31 
GeneralRe: Can a template parameter be restricted to primitive types? Pin
HosamAly19-Sep-08 23:38
HosamAly19-Sep-08 23:38 
QuestionConcatenation or Data Type problem :s Pin
Muammar©18-Sep-08 11:11
Muammar©18-Sep-08 11:11 
AnswerRe: Concatenation or Data Type problem :s Pin
Mbah Dhaim18-Sep-08 12:54
Mbah Dhaim18-Sep-08 12:54 
GeneralRe: Concatenation or Data Type problem :s Pin
Muammar©18-Sep-08 23:06
Muammar©18-Sep-08 23:06 
QuestionProblems connecting to excel with c# 2005 over windows2000 Pin
R.A.C18-Sep-08 10:05
R.A.C18-Sep-08 10:05 
Hello

I have a program that is connecting to an excel file, run a query and fill a dataset,

My program is running ok in my computer (windows XP pro) but when I try to run in a windows 2000 computer I got an Exception with the excel file,

Please could you help me?

Thanks

This is the code for my class

class AS400PN
{

private OleDbConnection xlCon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + System.Windows.Forms.Application.StartupPath + "\\ITEMS.xls;Extended Properties=Excel 8.0;");
private OleDbDataAdapter xlDataAdapter;
private DataSet xlDataSet = new DataSet();
public int iNumRecords = 0, iNumAllRecords = 0;
public string sRev, sDescription;

public AS400PN() { }

public void LoadParams(string PartNumber)
{
try
{
File.Copy("\\\\serverm\\public\\items\\items.xls", System.Windows.Forms.Application.StartupPath + "\\items.xls", true);
xlCon.Open(); //Open OLE/DB connection to Excel
xlDataAdapter = new OleDbDataAdapter("SELECT * FROM [ITEMS" +"$] WHERE ITNBR='" + PartNumber + "'", xlCon);
xlDataSet.Clear();
xlDataAdapter.Fill(xlDataSet);
iNumRecords = xlDataSet.Tables[0].Rows.Count;
xlCon.Close();

}
catch(Exception exc)
{

throw (new Exception("Error reading Excel file"));
}
finally
{
xlCon.Close();
}
}

Life is Great, and kids the best

AnswerRe: Problems connecting to excel with c# 2005 over windows2000 Pin
Paul Conrad18-Sep-08 10:27
professionalPaul Conrad18-Sep-08 10:27 
GeneralRe: Problems connecting to excel with c# 2005 over windows2000 Pin
R.A.C18-Sep-08 12:10
R.A.C18-Sep-08 12:10 
GeneralRe: Problems connecting to excel with c# 2005 over windows2000 Pin
Paul Conrad18-Sep-08 12:20
professionalPaul Conrad18-Sep-08 12:20 
QuestionWho can help ? Pin
Mohammad Dayyan18-Sep-08 10:03
Mohammad Dayyan18-Sep-08 10:03 
AnswerRe: Who can help ? Pin
Giorgi Dalakishvili18-Sep-08 10:14
mentorGiorgi Dalakishvili18-Sep-08 10:14 
AnswerRe: Who can help ? Pin
Eslam Afifi18-Sep-08 15:15
Eslam Afifi18-Sep-08 15:15 
GeneralRe: Who can help ? Pin
Mohammad Dayyan19-Sep-08 2:25
Mohammad Dayyan19-Sep-08 2:25 
AnswerRe: Who can help ? Pin
Eslam Afifi19-Sep-08 4:12
Eslam Afifi19-Sep-08 4:12 
GeneralRe: Who can help ? Pin
Mohammad Dayyan19-Sep-08 4:31
Mohammad Dayyan19-Sep-08 4:31 
GeneralRe: Who can help ? Pin
Eslam Afifi19-Sep-08 5:53
Eslam Afifi19-Sep-08 5:53 
QuestionReliabilityContractAttribute Pin
HosamAly18-Sep-08 9:26
HosamAly18-Sep-08 9:26 
Questionhow to fire button1_click event while pressing enter key Pin
Shuaib wasif khan18-Sep-08 8:39
Shuaib wasif khan18-Sep-08 8:39 
AnswerRe: how to fire button1_click event while pressing enter key Pin
DaveyM6918-Sep-08 8:56
professionalDaveyM6918-Sep-08 8:56 
AnswerRe: how to fire button1_click event while pressing enter key Pin
Alan N18-Sep-08 8:58
Alan N18-Sep-08 8:58 
QuestionHow to convert an object array to string Pin
soniaiq18-Sep-08 7:32
soniaiq18-Sep-08 7:32 
AnswerRe: How to convert an object array to string Pin
DaveyM6918-Sep-08 7:37
professionalDaveyM6918-Sep-08 7:37 
GeneralRe: How to convert an object array to string Pin
soniaiq18-Sep-08 7:47
soniaiq18-Sep-08 7:47 

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.