Get the App
SLTechnology News&Howtos  ›  Development  › 

How to configure SQL statements with multiple parameters by iBATIS.NET

Shulou Source: shulou.com Published: 2022-06-02 22:27:19 10月01日 Update

This article shows you how to iBATIS.NET multi-parameter SQL statement configuration, the content is concise and easy to understand, absolutely can make your eyes bright, through the detailed introduction of this article, I hope you can get something.

As I am not very proficient in iBATIS.NET, but also in learning while working practice, so the iBATIS.NET series of articles will not have a certain degree of consistency

These articles should be the accumulation of some knowledge about iBATIS.NET that I usually have. Let's get to the point:

When we use iBATIS.NET to manipulate data, we are sure to encounter SQL statement parameters

When we have a parameter, the XML mapping file for iBATIS is as follows:

< statement id= "getProduct" parameterClass= "System.Int32" > select * from PRODUCT where PRD_ID = # value# < / statement >

When we have multiple parameters, the XML is as follows:

< statement id= "getProduct" parameterClass= "System.Collections.IDictionary" > select * from PRODUCT where PRD_CAT_ID = # catId# and PRD_CODE = # code# < / statement >

A Hashtable must be assigned to him in the code, and the Hashtable has two keys, catId and code, so be careful to be case-sensitive.

When we execute the stored procedure, the xml is as follows:

First define the parameter definition set

< parameterMaps > < parameterMap id= "insertperson" class= "Person" > < parameter property= "FirstName" column= "PER_FIRST_NAME" / > < parameter property= "LastName" column= "PER_LAST_NAME" / > < / parameterMap > < / parameterMaps >

Then define the operation

Tags: Parameters statements configuration articles knowledge processing code content size skills time procedures storage concise concise two names multiple that is the situation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Linux Redmi Apple MariaDB