ADO. NET

Source: Internet
Author: User

1. Read the values of a column in a row of a table in dataset:

Pnds. Tables ["memo"]. Rows [2]. ItemArray [1]. ToString ()

This example reads the values in the 3rd rows and 2nd columns of the memo table ..

Note: The calculation of rows and columns starts from 0...

2. Obtain the total number of columns (total number of columns) of a table in dataset)

Pnds. Tables ["memo"]. Columns. Count

3. Obtain the total number of rows of a table in dataset (that is, the number of records)

Pnds. Tables ["memo"]. Rows. Count

4. retrieve a column name of a table in dataset

Pnds. Tables ["memo"]. Columns [2]. ToString ()

This example obtains the column name of column 3rd in the memo table ..

4.
. NET uses MySQL Connector Net 1.0.6 to insert data to the MySql database with garbled characters:
Problem:
When Chinese data is inserted, garbled characters are displayed on the interface, and database data is garbled ????.
Solution:
Add the connection string CharSet = gb2312;
Example: string connStr = "server = 58.135.48.45; user id = root; password = password; database = mysql; CharSet = gb2312 ;";

Other problems:
The database query syntax is correct, that is, the returned results are empty, and all the query results in mysql-front are returned. At that time, I was confused about the problem and I was depressed for a long time! It was originally in character encoding;
Asp.net <META http-equiv = "content-type" content = "text/html; charset = gb2312">, and the mysql database encoding is changed to gb2312, the ODBC driver is also set names 'gb2312'; no results are returned, and then GB2312 is SET in the database connection string;
From this we can see that the. net interface character must be gb2312 passed to the database!

This problem is solved.

5. The DropDownList property autopastback client automatically calls the server and refreshes the interface! Bad!
Use JS to change!

 

The same problem occurs in. net Windwow Forms programming! Character encoding is still not done!

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.