标签:
1 SELECT Field1,Field2,Field3 FROM table_name WHERE Field4=?
上述例子是由于OleDb不支持命名参数,以下均为OleDb作为例子。
1 <Statement> 2 <SQL><!CDATA[[SELECT Field1,Field2,Field3 FROM table_name WHERE Field4=?]]></SQL> 3 <Parameters> 4 <Parameter Name="@Field4" Type="System.String" /> 5 </Parameters> 6 <Result ReturnList="False/True" Type="Query.Information.ClientInfo,Query.Information.ClientInfo"> 7 <Field Name="Field1" Mapping="Dummy" Type="System.Decimal" /> 8 <Field Name="Field2" Mapping="Name" Type="System.String" /> 9 <Field Name="Field3" Mapping="Salary" Type="System.Double" /> 10 </Result> 11 </Statement>
1 public classClientInfo{ 2 [Entity]public decimal Dummy{ get; set; } 3 [Entity]public string Name{get;set; } 4 [Entity]public double Salary{get;set; } 5 }
1 object SQLHelper.Execute(XXXConnection connection, string profile, Dictionary<string, string> KV);
方法如下:
1 Dictionary<string,string> KV = new Dictionary<string,string>(); 2 KV.Add("@Field4", "SID0001"); 3 Query.Information.ClientInfo clientInfo 4 = SQLHelper.Execute(connection, "获得产品信息", KV) as Query.Information.ClientInfo;
或者:
1 Dictionary<string,string> KV = newDictionary<string,string>(); 2 KV.Add("@Field4", "SID0001"); 3 List<Query.Information.ClientInfo>clientInfo 4 = SQLHelper.Execute(connection, "获得产品信息", KV) as List<Query.Information.ClientInfo>;
标签:
原文地址:http://www.cnblogs.com/charset/p/4561339.html