|
Hi,
Trying to read the data from an excel spreadsheet in C# 2005, but there is an error as follows:
The Microsoft Jet database engine could not find the object 'Cities$'. Make sure the object exists and that you spell its name and the path name correctly.
The excel speadsheet is placed in the same place as Program.cs and the sheet name is indeed cities.
This is the code:
private void btnExcel_Click(object sender, EventArgs e)
{
string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Book1.xls;Extended Properties=""Excel 8.0;HDR=YES;""";
DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.OleDb");
using (DbConnection connection = factory.CreateConnection())
{
connection.ConnectionString = connectionString;
using (DbCommand command = connection.CreateCommand())
{
// Cities$ comes from the name of the worksheet
command.CommandText = "SELECT ID,City,State FROM [Cities$]";
connection.Open();
using (DbDataReader dr = command.ExecuteReader()) //fails here...
{
while (dr.Read())
{
Console.WriteLine(dr["ID"].ToString());
}
}
}
}
}
|
|
|
|
|
Are you sure the page has the same name?
|
|
|
|
|
When I open the file Book1.xls, the sheet name is Cities whereas in the select query I am using [Cities$]. used Cities instead but no change.
|
|
|
|
|
fmardani wrote: The excel speadsheet is placed in the same place as Program.cs
The Book1.xls needs to be in the same directory as your .exe. Place the Book1.xls file in the \bin\Debug directory if you are debugging and in \bin\Release if you are running in release mode.
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Hi...
I want to use FIFO queue concept for PC serial port communication through PC com port for data transmission & reception.
Can anybody suggest me any good document available on net for this or any suggestion how i can use it in my application...?
Thanks,
Vinay
|
|
|
|
|
Hi
ich brauche dringend Hilfe bei DirectShow
Gruss
Stephan
|
|
|
|
|
Lesen sie die forums am http://sourceforge.net/projects/directshownet/
Diese forum ist nuer fuer Englische sprache.
Aber was ist deine frage?
|
|
|
|
|
I don't know how to generate a random string.
Please help me.
I have Visual Studio 2003.
Vasildb
|
|
|
|
|
Depends on how random you want it...
Though, System.Random class should do it. Take the random double and to a ToString() on it.
|
|
|
|
|
Can you elaborate a little bit more? Is it a fixed length? is there a min size or max size? What characters can you use? 0-9 and a-Z or special chars too?
V.
Stop smoking so you can: enjoy longer the money you save.
|
|
|
|
|
create an array of chars and create each char as a random string using the random class.
|
|
|
|
|
If know the IP Address of a system connected to my LAN, how can i determine the list of folders shared by the system.
Thanks.
|
|
|
|
|
Hi All,
I developed a component for which I use the OnMouseWheel event to implement a zoom function. Originally, my component derived from System.Windows.Forms.Form ; and everything was good.
Later, I decided i wanted to host the component inside of a SplitContainer, and since SplitContainer won't take a form, I had to convert the component to inherit Control.
Everything works fine, except that the OnMouseWheel event is never fired. If i add a handler for the form's MouseWheel event, that is fired, my my control never receives the message.
I can't see any reason for this in MSDN. Anyone got any ideas or pointers on how i can have my control receive the mouse wheel scroll messages?
Thanks
Jon
|
|
|
|
|
write following code after your initialize componenet
this.myControl.MouseDown += new System.Windows.Forms.MouseEventHandler(this.myControl.MyControl_MouseDown);
sameer
|
|
|
|
|
thanks for the reply, but what has that got to do with my mouse wheel question?
|
|
|
|
|
Good day
I get a JIT error when i try to run my application from a network share. It throws a SecurityException. Try to catch this exception through code has been fruitless.
Is there a way to catch or guard against this error? Or is there a way around it?
Thanks
Kulile --- RSA
|
|
|
|
|
|
thanks a lot
Kulile --- RSA
|
|
|
|
|
i'm tring to scroll a picture box using the drag-drop functionality, i have a small panel and a big picturebox in it and i want the panel to scroll the piscturebox when i drag and drop it (exactly like in Acrobat reader). What code am i supose to write to meve the picture box??
and another question:
say i want to center the panell view on o specific point on the picturebox, how do i do that??
-- modified at 9:16 Monday 6th November, 2006
rzvme
|
|
|
|
|
I need to know if i can implement the edges and borders of a button or a panel or any other control. Or if there is any other library that i can download or reference to, that have special buttons (labels, panels, textfields, ...) that have special appearance but ofcourse with the same functionality of the standard controls in the VS2005.
Best Regards.
Jamil Abou Khalil
|
|
|
|
|
|
hi,
i couldn't find anything helpfull in any of these links that u provided for me.
hope if you can provide me with some souce code or sample or something like that. i will be verry greatfull to u.
Thank you
jamil abou khalil
|
|
|
|
|
If you download that Krypton Toolkit you can use the controls in that library and set their colours, borders to what you want, there are lots of samples as well.
|
|
|
|
|
hi
i want to load any avi into memoryStream by loop cycle and play it until memoryStream finish loading.
can anybody help to me how to do ?
|
|
|
|
|
hi,
i´ve got a problem with capturing a image from a webcam.
i can only capture a picture with a resolution of 640x480, but i need a resolution of 1280x1024.
the webcam support the resolution of 1280x1024.
stephan
|
|
|
|