C # Use & quot; like "in the program to query access database queries that are empty,

Source: Internet
Author: User

C # "like" is used in the program to query access database queries that are empty,

Today, we found a particularly strange problem during the development process: the like query in access is executed in the Access database and the query results can be found, which is executed in the database, select * from KPProj where KpName like '* test *', but the same statement is null in the c # program. What is the situation?

This problem is really tangled. through previous development experience, like in access needs to use the * number, but the standard % should be used in SQL Server oracle databases. Why can't this happen at this time? After searching for information, I found that the access driver was connected. Previously I used mdb, and the database was accdb. Then I used the win7 64-bit development system, because Access in my program uses the oledb driver, "*" cannot be used here, and "%" must be used ". If you use DAO to Access the Access database, you must use "*".

* Is not used in case of access, so it should be determined based on the actual driver;
C language ^ how to use

A1 = 0x01; // 0000 0001
A2 = 0x00; // 0000 0000
A3 = 0x03; // 0000 0011
A4 = 0x02; // 0000 0010

B1 = a1 ^ a2; // 0000 0001
B2 = a1 ^ a3; // 0000 0010
B3 = a1 ^ a4; // 0000 0011

^ XOR operator. The bitwise value is 0 and the difference is 1. See the example above.

//
Examples of simple and practical problems:
====================================
======= A ======= B =========
There are two circuits on the top. The two switches are a and B respectively. The opening status is \ [1], and the closing status is/[0].
If both circuits are enabled or disabled.
If a turns on [1], B turns off [0], and circuit 1 Powers on
=====================
If a disables [0], B enables [1], and circuit 2 powers on.
====================================
In summary, the circuit fails in the and B states simultaneously [0]. When a and B are different, the power is charged [1].

Symbol in C Language <Yes

Left shift operator (<)

Removes all the binary bits of an operation object from the left and adds 0 to the right ).

For example, a = a <2 shifts the binary bits of a two places to the left and complements 0 to the right,

Move 1 to the left and then a = a * 2;

If the left shift does not include 1 in the Discard high position, then shifts one bit left, which is equivalent to multiplying the number by 2.
Shift right operator (>)

Shifts all the binary bits of a number to several places to the right, and adds 0 to the left of the positive number, 1 to the left of the negative number, and discards the right of the negative number.

The operand shifts one digit to the right, which is equivalent to dividing the number by 2.

For example, a = a> 2 shifts the binary bit of a two places to the right,

0 or 1 to see whether the number is positive or negative.

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.