[Mono-list] Mono Sqlite Question

Marc Glenn mjamon at ntsp.nec.co.jp
Fri Aug 15 02:04:03 EDT 2008

Hello guys,

     I found this code at http://www.mono-project.com/SQL_Lite

    I want to ask why it is important to assign null to the Sqlite 
objects used in the main function.
    Since the function will exit and the local variables used will be 
    Is it really important to assign *null *to those variables?
    Is there a specific behaviour of Mono Sqlite that I should know about?

Thanks in advance,
Marc Glenn

*Please see code below:
*     using System;
     using System.Data;
     using Mono.Data.SqliteClient;
     public class Test
        public static void Main(string[] args)
           string connectionString = "URI=file:SqliteTest.db";
           IDbConnection dbcon;
           dbcon = (IDbConnection) new SqliteConnection(connectionString);
           IDbCommand dbcmd = dbcon.CreateCommand();
           // requires a table to be created named employee
           // with columns firstname and lastname
           // such as,
           //        CREATE TABLE employee (
           //           firstname varchar(32),
           //           lastname varchar(32));
           string sql =
              "SELECT firstname, lastname " +
              "FROM employee";
           dbcmd.CommandText = sql;
           IDataReader reader = dbcmd.ExecuteReader();
           while(reader.Read()) {
                string FirstName = reader.GetString (0);
                string LastName = reader.GetString (1);
                Console.WriteLine("Name: " +
                    FirstName + " " + LastName);
           *// clean up*
           *reader = null;*
           *dbcmd = null;*
           *dbcon = null;*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20080815/59a0ecd2/attachment-0001.html 

More information about the Mono-list mailing list