Parameters
- rowValue
- String that contains data for PgSqlRow.
Return Value
Parsed PgSqlRow.
static void InsertDataWithParameters(PgSqlConnection conn) { string str = "INSERT INTO personnel VALUES (:ID, :ROW)"; PgSqlCommand pgCommand = new PgSqlCommand(str,conn); //Create instance of PgSqlRow and parse data //Note that connection must be open PgSqlRowType pgRowType = PgSqlRowType.GetRowType("tperson", conn); PgSqlRow pgRow = pgRowType.Parse("(''Robert'',30)"); //provide parameters to command and execute it pgCommand.Parameters.Add("ID",4); pgCommand.Parameters.Add("ROW",pgRow); pgCommand.ExecuteNonQuery(); Console.WriteLine("Record added"); }
Sub InsertDataWithParameters(ByVal conn As PgSqlConnection) Dim str As String = "INSERT INTO personnel VALUES (:ID, :ROW)" Dim pgCommand As PgSqlCommand = New PgSqlCommand(str, conn) 'Create instance of PgSqlRow and fill with data 'Note that connection must be open Dim pgRowType As PgSqlRowType = PgSqlRowType.GetRowType("tperson", conn) Dim pgRow As PgSqlRow = pgRowType.Parse("(''Robert'',30)") 'provide parameters to command and execute it pgCommand.Parameters.Add("ID", 3) pgCommand.Parameters.Add("ROW", pgRow) pgCommand.ExecuteNonQuery() Console.WriteLine("Record added") 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