Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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

Share To

Development

© 2024 shulou.com SLNews company. All rights reserved.

12
Report