How to change from MySQL to ADODB (1) _ MySQL

Source: Internet
Author: User
Advanced materials Insert and Update assume that you want to Insert the following data into the database. ID3TheDatemktime (,) * 31stAugust2001 * Notesugarwhydontwecallitoff when you use another database, your insert operation may not succeed. The first problem is that every database has Advanced Materials
Insert and Update
Suppose you want to insert the following data into the database.
  
ID = 3
TheDate = mktime (2001,)/* 31st August */
Note = sugar why don't we call it off
  
When you use another database, your insert operation may not be successful.
  
The first problem is that each database has a different default date format. The default MySQL format is YYYY-MM-DD,
However, other databases have different default formats. ADODB has a DBDate () function that can convert a date
Change to the correct format.
  
The next question is that the don't in the Note field value should be used as a citation. In MySQL, use
Don \'t to solve this problem, but in some other databases (Sybase, Access, Microsoft
SQL Server) use don't. Qstr () solves this problem.
  
How can we use this function? As shown below:
  
$ SQL = "INSERT INTO table (id, thedate, note) values (". $ ID. ','. $ db-> DBDate ($ TheDate ). ','. $ db-> qstr ($ Note ). ")"; $ db-> Execute ($ SQL); ADODB also supports $ connection-> Affected_Rows () (returns the impact of the last update or delete operation
And $ recordset-> Insert_ID () (returns the last auto-increment number generated by the insert statement ). However
Whether all databases support these two functions.
  
   Policypes
You can find

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.