Understanding of ADO. NET development in C #

Source: Internet
Author: User
Tags mdb database

I have been writing something for a long time, and I will write another article before I start school. Recently, I have been playing a database, and I have nothing to do for a winter vacation. I wrote a commemorative day reminder and a personal income and expenditure management.Program.
New Access to C # ADO. Net has encountered many difficulties. I hope to help you.
The first is the database link. I use access 2007 (it is difficult to set up SQL Server in Vista). I have no books to describe the connection string of access 2007, I have been searching for the Internet for a long time (I finally found the =_= | found in the data source). Here I will provide it to you (the General connection input is enough, if you need a password or advanced connection, extract it from the complete string ):
Provider = Microsoft. Ace. oledb.12.0; Data Source = ××. accdb;
[View the complete access 2007 connection string below]

Code
Provider = Microsoft. Ace. oledb. 12.0 ; User ID = Admin; Data Source = C: Documents And Settings chengemy documents database 1. accdb; Mode = Share Deny   Read | Share Deny Write; extended Properties = ""; Jet oledb: System Database = C: Documents And Settingschengeapplication datamicrosoftaccesssystem. MDW; Jet oledb: Registry path = Softwaremicrosoftoffice12.0accessaccess connectivity engine; Jet oledb: Database Password = ""; Jet oledb: Engine type = 6 ; Jet oledb: Database Locking Mode = 0 ; Jet oledb: Global partial Bulk Ops = 2 ; Jet oledb: Global Bulk Transactions = 1 ; Jet oledb: New Database Password = ""; Jet oledb: Create System Database = False; Jet oledb: Encrypt Database = False; Jet oledb: Don ' T copy locale on compact = false; Jet oledb: compact without replica repair = false; Jet oledb: SFP = false; Jet oledb: support complex data = true

note that if access 2007 is not installed on another machine, the program throws an exception saying that the ace. oledb.12.0 database driver cannot be found. The result of debugging on XP is that XP cannot use the 2003 database by default (even if access 2007 is installed. So if your program wants to run on XP, you 'd better create an mdb database and access it with the database engine of Microsoft JET 4.0 oledb.
note that C # uses '*' or '%' for multiple matches when writing SQL statements '. We know that multiple matches in the access regular expression should be '*', but why can't I execute it using oledbcommand? The reason is that the SQL Server syntax should be written in C #, that is, '%' should be used ', your C # program automatically converts SQL statements into SQL statements suitable for access during compilation. That is to say, many SQL Server statements that support but do not support access do not report errors when writing them. However, once executed, problems may occur.
there is also the problem of creating tables and indexes. In the past, MSSQL was used for learning, and multiple statements were used for execution. I am not used to using the access 2007 GUI mode this time. I would like to give you some suggestions here, but it is better to use commands to create them. By the way, we recommend a database SQL-lite. The database capability alone is more powerful than access (open-source and powerful). However, because it is also open-source, the database does not provide the password function (but the encryption module can be found online due to open-source ).
the last note is that the calendar control in C # is displayed differently on different machines.-_-|, depending on you.. Net versions are different. NET 2.0 is the same, you are installing. net). If you have time, you can try it on a virtual machine. I have to re-Modify the interface because the Vista and XP interfaces are different .......

The winter vacation is about to end this week. I will summarize the things I learned during the winter vacation,ArticleAt the end of the winter vacation two works sent up to dry, need friends can leave E-MAIL, here does not provide the source code (put here for fear of shame ah ).


 

Code:

SkyDrive: http://cid-856b7a1fbf560755.skydrive.live.com/browse.aspx/My%20free%20softwares/FinancialStatistics

One is a database, and the other isSource code. Both files are RAR compressed files.

Related Article

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.