'Declaration Public Shadows Function CreateParameter() As DB2Parameter
public new DB2Parameter CreateParameter()
Return Value
A DB2Parameter object.
'Declaration Public Shadows Function CreateParameter() As DB2Parameter
public new DB2Parameter CreateParameter()
Public void CreateParam(DB2Connection db2Connection) { DB2Command db2Command = new DB2Command("SELECT * FROM Dept WHERE DeptNo=:Deptno",db2Connection); DB2Parameter myParam = db2Command.CreateParameter(); myParam.DB2Type = Devart.Data.DB2.DB2Type.Int; myParam.Value = 10; myParam.ParameterName = "Deptno"; db2Command.Parameters.Add(myParam); db2Connection.Open(); DB2DataReader db2Reader = null; try { db2Reader = db2Command.ExecuteReader(); while (db2Reader.Read()) { Console.WriteLine(db2Reader.GetInt32(0) + ", " + db2Reader.GetString(1) + ", " + db2Reader.GetString(2)); } } finally { db2Reader.Close(); db2Connection.Close(); } }
Public Sub CreateParam(ByVal db2Connection As DB2Connection) Dim db2Command As New DB2Command("SELECT * FROM Dept WHERE DeptNo=:Deptno", db2Connection) Dim myParam As DB2Parameter = db2Command.CreateParameter() myParam.DB2Type = Devart.Data.DB2.DB2Type.Int myParam.Value = 10 myParam.ParameterName = "Deptno" db2Command.Parameters.Add(myParam) db2Connection.Open() Dim db2Reader As DB2DataReader = Nothing Try db2Reader = db2Command.ExecuteReader() While db2Reader.Read() Console.WriteLine(db2Reader.GetInt32(0).ToString() + ", " _ + db2Reader.GetString(1) + ", " _ + db2Reader.GetString(2)) End While Finally db2Reader.Close() db2Connection.Close() End Try End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2