Asp.net connection Access Database Data Type Problems

Source: Internet
Author: User

Problems
When you obtain the Document ID on the modify page
The program is interrupted, prompting that the data type does not match when the class is executed. After careful consideration, it may be that the database access ID is an auto-increment number and a number.
You cannot add '"+ ID +"' to the ID "'
String plain text = "select * From tb_leaveword where id = '" + ID + "'";
This statement will not be wrong in sqlserver.
Later, I checked the information on the Internet and found that the access process was not stored. I was a beginner and did not speak well. I wrote down my problems,
Hope to help people in need
Solution
Set string plain text = string. Format ("select * From tb_leaveword where id = {0}", ID );
Problem Solving

/* -------------- The following code is --------*/
Int id = convert. toint32 (request. querystring ["ID"]. tostring ());
String plain text = string. Format ("select * From tb_leaveword where id = {0}", ID );
Oledata = new oledata (); // oledata is a custom data processing class.
Oledbdatareader READ = oledata. getread (plain text );
If (read. Read ())
{
Showname = read ["uid"]. tostring ();
Showsubject = read ["subject"]. tostring ();
Showcontent = read ["content"]. tostring ();
Showtime = read ["datetime"]. tostring ();
}

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.