Add(String,PgSqlType) Method
Adds a
PgSqlParameter to the
PgSqlParameterCollection given the parameter name and data type.
The following example creates a
PgSqlParameterCollection, adds instances of
PgSqlParameter to the collection, and returns a reference to the new
PgSqlParameter.
public void CreatePgSqlParamColl(PgSqlConnection myConn) {
PgSqlCommand pgCommand = new PgSqlCommand("SELECT * FROM Test.Dept WHERE DeptNo = :DeptNo", myConn);
PgSqlParameterCollection myParamCollection = pgCommand.Parameters;
object myParm = new PgSqlParameter("DeptNo", PgSqlType.Int);
int pIndex = myParamCollection.Add(myParm);
}
Public Sub CreatePgSqlParamColl(myConn As PgSqlConnection)
Dim pgCommand As PgSqlCommand = New PgSqlCommand("SELECT * FROM Test.Dept WHERE DeptNo = :DeptNo", myConn)
Dim myParamCollection As PgSqlParameterCollection = pgCommand.Parameters
Dim myParm As Object = New PgSqlParameter("DeptNo", PgSqlType.Int)
Dim pIndex As Integer = myParamCollection.Add(myParm)
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