C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

Reading Excel with OleDB


Posted Date: 10 Oct 2008      Posted By: Toral      Member Level: Bronze     Points: 1   Responses: 2



Hi
I am creating one application where in I am reading excel sheet. I am reading the sheet using OleDB. Somehow it is not reading one coulumn.
I have added IMEX = 1; also. But still no luck. Please guide me.





Responses

Author: Rex Sahaya Gregory    15 Oct 2008Member Level: BronzeRating: 4 out of 54 out of 54 out of 54 out of 5     Points: 6

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");

DbDataAdapter adapter = factory.CreateDataAdapter();

DbCommand selectCommand = factory.CreateCommand();
selectCommand.CommandText = "SELECT ID,City,State
FROM [Cities$]";

DbConnection connection = factory.CreateConnection();
connection.ConnectionString = connectionString;

selectCommand.Connection = connection;

adapter.SelectCommand = selectCommand;

DataSet cities = new DataSet();

adapter.Fill(cities);

gridEX1.SetDataBinding(cities.Tables[0], "");
gridEX1.RetrieveStructure();



Author: Pradeep Iyer    10 Dec 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 6

The BehaviorEditorPart class is an editor control that derives from the EditorPart class, and is used to edit properties that affect the behavior of an associated WebPart or GenericWebPart control.


BehaviorEditorPart – This editor part alters the visibility of verbs


Web parts are reusable pieces of code that are logically grouped together into one unit. They can be a single standard .NET server control, a web user control, or a custom control. Editor part controls can be used to change the design and layout of web parts in the browser at runtime. These controls edit the default properties made available through the web part framework, which are retained through the personalization provider. Some of the properties available from the editors include: title, height, width, chrome type, direction, zone index, and many other properties. The .NET framework offers several editor parts out of the box:

AppearanceEditorPart – This editor part alters the title, width, height, chrome type, and other properties of existing editor parts.
BehaviorEditorPart – This editor part alters the visibility of verbs (close, minimize, restore, etc.), as well as editing the description and images used in the web part.
LayoutEditorPart – This editor part changes the location of an editor part, through the zone name or the zone index.
PropertyGridEditorPart – This editor part edits custom properties; this editor will be discussed in a future article.

Web parts exist within a "zone", a container control that can contain one or more web parts. Zones define regions within the application that web parts must belong in. They also define user interface features of web parts, such as title color and style, as well as the availability of web part verbs (standard or customizable actions that can be performed for web parts and zones, such as the Close or Minimize verbs). Editor parts can only appear within an editor zone, and no other type. This is the same for other types of zones; web parts can only appear in web part zones, as well as catalog parts can only appear in catalog zones.

Regards,
Pradeep Iyer



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Active Directory Security
Previous : How integrate gears into dotnet webbrowser
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use