C # Windows Client Development Pit

Source: Internet
Author: User

Recently, to help a friend to do a small software, need to use the database and Excel read and write operations, about the database crud will not say, Just say one thing: XP and Win7 for Environment.currentdirectoty recognition incredibly inconsistent, resulting in the use of OpenDialog, the database is often not found.


Excel read and write operations, related to the lower left corner of the Excel table name recognition problem, some "Sheet1", some "worksheet 1", this problem can be solved using the following methods:

OleDbConnection oleconn = new OleDbConnection (strconn);            Oleconn.open ();            DataTable schematable = oleconn.getoledbschematable (OleDbSchemaGuid.Tables, new object[] {null, NULL, NULL, "TABLE"}); c4/>string strtablename = schematable.rows[0]["table_name"]. ToString (). Trim ();

Be sure to Oleconn.open () first, then check the name of the table, or there will be a crash phenomenon.



C # Windows Client Development Pit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.