Is there a standard way of creating Examples pages in ECMA that we can reference from the topics or do the common examples have to be copied in each topic?
Regards -fawad
Index: class/Npgsql//en/Npgsql/NpgsqlCommand.xml =================================================================== RCS file: /mono/monodoc/class/Npgsql/en/Npgsql/NpgsqlCommand.xml,v retrieving revision 1.1 diff -r1.1 NpgsqlCommand.xml 12,13c12,30 < <summary>To be added</summary> < <remarks>To be added</remarks> --- > <summary>Represents a command to be executed against the PostgreSQL database > backend.</summary> > <remarks> > <para> > An NpgsqlCommand object is associated with a <see > cref="T:Npgsql.NpgsqlConnection" /> instance.It can be used to execute > SQL statements (SELECT, INSERT, UPDATE, DELETE, etc.), stored > procedures and functions against the database the <see > cref="T:Npgsql.NpgsqlConnection" /> > instance referenced in the <see > cref="P:Npgsql.NpgsqlCommand.Connection" /> is associated with. > </para> > <para> > As the NpgsqlCommand implements the <see > cref="T:System.Data.IDbCommand" /> interface, it can be used to > <list type="bullet"> > <item><term>Execute queries without expecting a result back > using the > <see cref="M:Npgsql.NpgsqlCommand.ExecuteNonQuery" /> > method</term></item> > <item><term>Execute queries only a single (scalar) result back > using the > <see cref="M:Npgsql.NpgsqlCommand.ExecuteScalar" /> > method</term></item> > <item><term>Execute queries without expecting a > <see cref="Npgsql.NpgsqlDataReader" /> back using the > <see cref="M:Npgsql.NpgsqlCommand.ExecuteDataReader" /></term></item> > </list> > </para> > </remarks> 73,75c90,138 < <summary>To be added</summary> < <returns>a <see cref="T:System.Int32" /></returns> < <remarks>To be added</remarks> --- > <summary>Executes a query against the database backend without expecting > data back from it</summary> > <returns>A <see cref="T:System.Int32" /> containing the number of records > affected on the database by the query</returns> > <remarks> > <para> > The <see cref="M:Npgsql.NpgsqlCommand.ExecuteNonQuery" > /> method is used to execute a query against the database > without exepecting a result back. This is useful for > running data manipulation commands, etc. > </para> > <para> > The following example demonstrates the use of the > method against a database. For the example to work, a user 'joe' > with the password 'secret' needs to have access to the > 'table1' table in the 'joedata' database created with the SQL > </para> > <c> > CREATE TABLE table1 (int1 INTEGER, int2 INTEGER); > </c> > <code lang="C#"> > /* Compiling: > * mcs -r:Npgsql -r:System.Data NpgsqlExecuteNonQuery.cs > */ > using System; > using System.Data; > using Npgsql; > > public class NpgsqlExecuteNonQuery > { > public static void Main(String[] args) > { > NpgsqlConnection conn = new > NpgsqlConnection("Server=127.0.0.1;Port=5432;User > Id=joe;Password=secret;Database=joedata;"); > conn.Open(); > > NpgsqlCommand command = new NpgsqlCommand("insert into table1 > values(1, 1)", conn); > Int32 rowsaffected; > > try > { > rowsaffected = command.ExecuteNonQuery(); > Console.WriteLine("Just added {0} lines in the table table1", > rowsaffected); > } > finally > { > conn.Close(); > } > } > } > </code> > <para> > Executing the query should give the output > </para> > <c>Just added 1 lines in the table table1</c> > </remarks> 115,117c178,253 < <summary>To be added</summary> < <returns>a <see cref="T:System.Object" /></returns> < <remarks>To be added</remarks> --- > <summary>Executes a query against the <see cref="T:Npgsql.NpgsqlConnection" > /> and expects a single value as output</summary> > <returns>a <see cref="T:System.Object" /> containing the output > value.</returns> > <remarks> > <para> > This command returns a single value as the output of the > command execution. > </para> > <code lang="C#"> > using System; > using System.Data; > using Npgsql; > > public class NpgsqlExecuteScalar > { > public static void Main(String[] args) > { > NpgsqlConnection conn = new > NpgsqlConnection("Server=127.0.0.1;Port=5432;User > Id=joe;Password=secret;Database=joedata;"); > conn.Open(); > > NpgsqlCommand command = new NpgsqlCommand("select version()", conn); > String serverversion; > > try > { > serverversion = (String)command.ExecuteScalar(); > Console.WriteLine("PostgreSQL server version: {0}", > serverversion); > } > finally > { > conn.Close(); > } > } > } > </code> > <para> > Compiling and executing the above code gives the output > </para> > <c>PostgreSQL server version: PostgreSQL 7.3.2 on > i386-redhat-linux-gnu, compiled by GCC i386-redhat-linux-gcc (GCC) 3.2.2 20030213 > (Red Hat Linux 8.0 3.2.2-1)</c> > <para> > If a query is executed that returns more than one column > and/or more than one row, only the first column in the first row is returned. > > For example, tweaking the above example to make it > <code Lang="C#"> > using System; > using System.Data; > using Npgsql; > > public class NpgsqlExecuteScalar > { > public static void Main(String[] args) > { > NpgsqlConnection conn = new > NpgsqlConnection("Server=127.0.0.1;Port=5432;User > Id=joe;Password=secret;Database=joedata;"); > conn.Open(); > > NpgsqlCommand command = new NpgsqlCommand("select version(), > upper('foo')", conn); > String serverversion; > > try > { > serverversion = (String)command.ExecuteScalar(); > Console.WriteLine("PostgreSQL server version: {0}", > serverversion); > } > finally > { > conn.Close(); > } > } > } > </code> > > still prints > </para> > <c>PostgreSQL server version: PostgreSQL 7.3.2 on > i386-redhat-linux-gnu, compiled by GCC i386-redhat-linux-gcc (GCC) 3.2.2 20030213 > (Red Hat Linux 8.0 3.2.2-1)</c> > <para> > Note that the exact output in the above will vary depending on > the exact version of the database. > </para> > </remarks> 232,234c368,374 < <summary>To be added</summary> < <returns>a <see cref="T:Npgsql.NpgsqlConnection" /></returns> < <remarks>To be added</remarks> --- > <summary>Connection to the PostgreSQL backend</summary> > <returns>a <see cref="T:Npgsql.NpgsqlConnection" /> object</returns> > <remarks> > The Connection property is a reference to the <see > cref="T:Npgsql.NpgsqlConnection" /> the commands will be executed against. > The connection must be open before the command can be > executed. If a command is executed against a closed connection, > a <see cref="T:System.InvalidOperationException" /> is thrown. > </remarks> Index: class/Npgsql//en/Npgsql/NpgsqlConnection.xml =================================================================== RCS file: /mono/monodoc/class/Npgsql/en/Npgsql/NpgsqlConnection.xml,v retrieving revision 1.1 diff -r1.1 NpgsqlConnection.xml 13c13,19 < <remarks>To be added</remarks> --- > <remarks> > <para> > This represents a unique connection to a PostgreSQL database backend. > The connection is used in conjunction with other classes > in the <see cref="N:Npgsql" /> provider like <see > cref="T:Npgsql.NpgsqlCommand" />, <see cref="T:Npgsql.NpgsqlDataReader" />, and > <see cref="T:Npgsql.NpgsqlDataAdapter" /> to fetch, add, update, or > delete data in the database. > </para> > </remarks> 87a94 > using System; 91c98 < public static class NpgsqlUserManual --- > public class NpgsqlConnDemo 94a102 > // Create a new connection object 95a104 > // Open the connection 96a106 > // Close it 231c241 < </Type> \ No newline at end of file --- > </Type>