当前位置: 首页>>代码示例>>C#>>正文


C# OdbcDataReader.Close方法代码示例

本文整理汇总了C#中System.Data.Odbc.OdbcDataReader.Close方法的典型用法代码示例。如果您正苦于以下问题:C# OdbcDataReader.Close方法的具体用法?C# OdbcDataReader.Close怎么用?C# OdbcDataReader.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.Odbc.OdbcDataReader的用法示例。


在下文中一共展示了OdbcDataReader.Close方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DisplayRecords

        /// <summary>
        /// DisplayRecords: This function displays the records in the view if any.
        /// </summary>
        static void DisplayRecords()
        {
            Console.Write("\tRecords in Prescirption list...");

            try
            {
                reader = (OdbcDataReader)command.ExecuteReader();
                // read the returned resultset
                while (reader.Read())
                {
                    /*
                     * This view consists the following fields:
                     * rxdef_id (TINYINT)
                     * drug_name (CHARACTER 50)
                     * description (CHARACTER 50)
                     * rx_date (DATE)
                     * For the purpose of keeping it simple, we are displaying the rxdef_id and drug_name on the console (the first two fields)
                     */
                    Console.WriteLine("\n\t\t{0}  {1}  ", reader.GetInt16(0), reader.GetString(1));
                }
                // close the reader
                reader.Close();
            }
            catch (Exception e)
            {
                ExceptionDisplay(e);
            }
        }
开发者ID:cgabilla,项目名称:cKarp,代码行数:31,代码来源:M6DtxConnector.cs

示例2: DisplayRecords

        /// <summary>
        /// DisplayRecords: This function displays the records in the view if any.
        /// </summary>
        static void DisplayRecords()
        {
            Console.Write("\tRecord in getpatientbalance stored procedure");

            try
            {
                reader = (OdbcDataReader)command.ExecuteReader();
                // read the returned resultset
                while (reader.Read())
                {
                    /*
                     * This view consists the following fields:
                     * pat_id
                     * pat_0_30_days
                     * pat_31_60_days
                     * pat_61_90_days
                     * pat_91_120_days
                     * pat_121_plus_days
                     * last_pmt_date
                     * last_pmt_amt
                     * last_pmt_type
                     * last_pmt_desc
                     */
                    Console.WriteLine("\npat_id:{0}\npat_0_30_days: {1}\npat_31_60_days: {2} \npat_61_90_days: {3}\npat_91_120_plus_days: {4} \npat_121_plus_days: {5}\nlast_pmt_date: {6} \nlast_pmt_amt: {7}\nlast_pmt_type: {8}\nlast_pmt_desc: {9}",
                        reader.GetValue(0), reader.GetValue(1), reader.GetValue(2), reader.GetValue(3), reader.GetValue(4), reader.GetValue(5), reader.GetValue(6), reader.GetValue(7), reader.GetValue(8), reader.GetValue(9));
                }
                // close the reader
                reader.Close();
            }
            catch (Exception e)
            {
                ExceptionDisplay(e);
            }
        }
开发者ID:cgabilla,项目名称:cKarp,代码行数:37,代码来源:StoredProcedureTutorial.cs

示例3: DisposeAll

 public static void DisposeAll(OdbcCommand sqlCommand, OdbcDataReader dbReader)
 {
     sqlCommand.Dispose();
     dbReader.Close();
 }
开发者ID:hsnamr,项目名称:ARS-Server,代码行数:5,代码来源:DB_Handler.cs

示例4: getDGPContacts

        public ArrayList getDGPContacts(string userId)
        {
            //Console.WriteLine("UserID: " + userId);
            try
            {
                ArrayList friendList = new ArrayList();
                itsCommand = new OdbcCommand("SELECT user FROM friends WHERE friend=\'" + userId + "\'",itsConnection);
                itsDataReader = itsCommand.ExecuteReader();
                for(int i = 0; itsDataReader.Read(); i++)
                {
            //		Console.WriteLine("Add friend: " + itsDataReader.GetString(0));
                    friendList.Add(itsDataReader.GetString(0));
                }
                itsCommand.Dispose();
                itsDataReader.Close();
                return friendList;
            }

            catch(OdbcException MyOdbcException)  //Catch any ODBC exception ..
            {
                this.handleException(MyOdbcException);
            }
            return null;
        }
开发者ID:mansehr,项目名称:DGP,代码行数:24,代码来源:Database.cs

示例5: testNameAndPassword

        public bool testNameAndPassword(string name, string password, Client client)
        {
            try
            {
                int itsInloggId;
                itsCommand = new OdbcCommand("",itsConnection);
                itsCommand.CommandText = "SELECT userID FROM users WHERE email=\'"+ name + "\'";
                itsDataReader =  itsCommand.ExecuteReader();
                if(itsDataReader.Read())
                {
                    itsInloggId = itsDataReader.GetInt32(0);
                    itsDataReader.Close();
                }
                else
                {
                    itsCommand.Dispose();
                    itsDataReader.Close();
                    return false;
                }

                itsCommand.CommandText = "SELECT password FROM users WHERE userID=\'"+ itsInloggId.ToString() + "\'";
                itsDataReader =  itsCommand.ExecuteReader();
                itsDataReader.Read();
                string databasePassword = itsDataReader.GetString(0);
                if(string.Compare(databasePassword, password, true) == 0)
                {
                    itsDataReader.Close();

                    itsCommand.CommandText = "SELECT * FROM users WHERE userID=\'"+ itsInloggId.ToString() + "\'";
                    itsDataReader =  itsCommand.ExecuteReader();
                    itsDataReader.Read();

                    client.Id = itsDataReader.GetString(0);
                    client.Email = name;
                    //client.IpNumber = itsDataReader.GetString(3);
                    client.DisplayName = itsDataReader.GetString(4);

                    itsCommand.Dispose();
                    itsDataReader.Close();
                    return true;
                }
                else
                {
                    itsCommand.Dispose();
                    itsDataReader.Close();
                    return false;
                }
            }
            catch (OdbcException MyOdbcException)//Catch any ODBC exception ..
            {
                this.handleException(MyOdbcException);
            }
            return false;
        }
开发者ID:mansehr,项目名称:DGP,代码行数:54,代码来源:Database.cs

示例6: readInt

 public int readInt( string sqlCommand)
 {
     try
     {
         int returnInt = 0;
         itsCommand = new OdbcCommand("", itsConnection);
         itsCommand.CommandText = sqlCommand;
         itsDataReader = itsCommand.ExecuteReader();
         while(itsDataReader.Read())
         {
             returnInt = itsDataReader.GetInt32(0);
         }
         itsCommand.Dispose();
         itsDataReader.Close();
         return returnInt;
     }
     catch (OdbcException MyOdbcException)//Catch any ODBC exception ..
     {
         this.handleException(MyOdbcException);
     }
     return 0;
 }
开发者ID:mansehr,项目名称:DGP,代码行数:22,代码来源:Database.cs

示例7: read

 public string read( string sqlCommand)
 {
     try
     {
         string returnString = "";
         itsCommand = new OdbcCommand("", itsConnection);
         itsCommand.CommandText = sqlCommand;
         itsDataReader = itsCommand.ExecuteReader();
         while(itsDataReader.Read())
         {
             if(returnString != "")
             {
                 returnString += "\n";
             }
             returnString += itsDataReader.GetString(0);
         }
         itsCommand.Dispose();
         itsDataReader.Close();
         return string.Copy(returnString);
     }
     catch (OdbcException MyOdbcException)//Catch any ODBC exception ..
     {
         this.handleException(MyOdbcException);
     }
     return "";
 }
开发者ID:mansehr,项目名称:DGP,代码行数:26,代码来源:Database.cs

示例8: getUserOnlineStatus

 public char getUserOnlineStatus(string id)
 {
     try
     {
         char itsChar;
         itsCommand = new OdbcCommand("",itsConnection);
         itsCommand.CommandText = "SELECT status FROM users WHERE userID=\'" + id + "\'";;
         itsDataReader =  itsCommand.ExecuteReader();
         if(itsDataReader.Read())
         {
             itsChar = itsDataReader.GetChar(0);
             itsDataReader.Close();
             itsCommand.Dispose();
             return itsChar;
         }
         else
         {
             itsDataReader.Close();
             itsCommand.Dispose();
             return 'Z';
         }
     }
     catch(OdbcException MyOdbcException)  //Catch any ODBC exception ..
     {
         this.handleException(MyOdbcException);
     }
     return 'Z';
 }
开发者ID:mansehr,项目名称:DGP,代码行数:28,代码来源:Database.cs

示例9: getUserLogginStatus

 public bool getUserLogginStatus(int itsId)
 {
     try
     {
         char itsChar;
         itsCommand = new OdbcCommand("",itsConnection);
         itsCommand.CommandText = "SELECT status FROM users WHERE userID=\'" + itsId + "\'";
         itsDataReader =  itsCommand.ExecuteReader();
         if(itsDataReader.Read())
         {
             itsChar = itsDataReader.GetChar(0);
             if(itsChar == 'Y')
             {
                 itsCommand.Dispose();
                 itsDataReader.Close();
                 return true;
             }
             else
             {
                 itsCommand.Dispose();
                 itsDataReader.Close();
                 return false;
             }
         }
         else
         {
             itsDataReader.Close();
             itsCommand.Dispose();
             return false;
         }
     }
     catch(OdbcException MyOdbcException)  //Catch any ODBC exception ..
     {
         this.handleException(MyOdbcException);
     }
     return false;
 }
开发者ID:mansehr,项目名称:DGP,代码行数:37,代码来源:Database.cs

示例10: loadNetQuantity

        internal string[] loadNetQuantity(string p)
        {
            //assign  variables
            m_dataReader = null;
            m_odbcCommand.CommandText = p;

            //open the DB and read the data
            OpenDB();
            m_dataReader = m_odbcCommand.ExecuteReader(CommandBehavior.CloseConnection);

            //intialize variables
            string[] stringList = new string[m_dataReader.FieldCount];

            //create single dimensional string array to hold DB values
            if (m_dataReader.Read())
            {
                int i = 0;
                while (i < m_dataReader.FieldCount)
                {
                    stringList[i] = m_dataReader[i].ToString();
                    i++;
                }
            }

            //close the connection and return the data
            m_dataReader.Close();
            return stringList;
        }
开发者ID:aaasekar,项目名称:store,代码行数:28,代码来源:db.cs

示例11: Close

 public void Close(OdbcDataReader reader)
 {
     if (reader != null) { reader.Close(); }
     Close();
 }
开发者ID:nettatata,项目名称:btsman,代码行数:5,代码来源:DBManager.cs


注:本文中的System.Data.Odbc.OdbcDataReader.Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。