Ado. NET and Oracle operations database how to assign Parameters

Source: Internet
Author: User
Tags comparison table

In use. NET when using OracleParameter for Oracle database operations, because Oracle and SQL Server have different syntax for query parameterization,

When you operate SQL Server, you are using @ParameterName.

And Oracle is using :P arametername .

and the SQL pseudo-statement also has a corresponding change, compare the difference between SQL Server and Oracle:

String sql = "Delete from PostInfo where [email protected]";

SqlParameter p1 = new SqlParameter("@id", id);

String sql = "Delete from PostInfo where id=:id";

OracleParameter P1 = new OracleParameter("id", id);

It is also necessary to check that the data types are consistent, with the data type comparison table for Oracle and SQL Server in C #.

Oracle data type comparison in C #

SQL Server data type comparison in C #

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.