Arjuna Aircraft Ident.: F-MBSD | J'ai surchargé le ToString finalement...
Ca marche pas trop mal :
Code :
- SqlDataAdapter adapter = new SqlDataAdapter("select objNum, typObj, objNam, objXml, usrCre, usrMod, usrVal, dteCre, dteMod, dteVal, dteBeg, dteEnd, objSta, objOri, typOri, objPar, typPar, objPos, objHom from objGet(" + objNum.ToString() + ", " + (new sqlString(objTyp)) + " )", cnx);
|
Code :
- using System;
- namespace Cms.Components.DataAccess
- {
- /// <summary>
- /// Summary description for sqlString.
- /// </summary>
- public class sqlString
- {
- private string Value;
- public sqlString()
- {
- }
- public sqlString(string initValue)
- {
- this.Value = initValue;
- }
- public override string ToString()
- {
- if (this.Value != null)
- return "'" + this.Value.Replace("'", "''" ).Replace("%", "%%" ) + "'";
- else
- return "null";
- }
- }
- public class sqlBool
- {
- private string Value;
- public sqlBool()
- {
- }
- public sqlBool(string initValue)
- {
- this.Value = initValue;
- }
- public override string ToString()
- {
- if (this.Value == null)
- {
- return "null";
- }
- else if (this.Value == "False" )
- {
- return "0";
- }
- else
- {
- return "1";
- }
- }
- }
- }
|
|