. Net experience in using SQL statements with parameters for access operations

Source: Internet
Author: User
I haven't written a blog for a long time, so I have to write something. There are not many new things recently, but access is a joke. Because parameters are rarely used when access is used before, they are all stored in the form of SQL statements and variables, however, it is boring to rewrite a website from the original SQL Server 2000 database to access recently (virtual space + MSSQL database is too expensive !! Only the following is available ). ProgramThere is no problem with rewriting, but there is a problem when access is operated. The first is the field type and. many enumeration types in oledbtype in. NET are not matched. For example, the remarks in access do not exist at the root of oledbtype, but they can be replaced by varchar or longvarchar. If we used the phase-in type instead, there should be no problem. However, the problem arises again! When writing updates and other database operations, I always say that my type is incorrect. Oh, my God. I tried all the similar types, but I still can't. After a twists and turns, we know that the order of parameters in access must be consistent with the order of parameters added to the command or adapter. For example, string SQL = "insert into a (name, PWD) values (@ name, @ PWD); then the order of adding oledbparameter is the same. You need to add the @ name parameter first, add the @ PWD parameter. In addition, in the previous "ado.net advanced programming" book, we mentioned that if sqlclient is used, its parameters are represented, when oledb is used, what is its parameter used? However, if you use oledb in Access 2003, you can use @ as the parameter symbol.

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.