示例#1
0
        public string db_select_operation(string _sql_string, string return_param)
        {
            string         ret_val = null;
            OdbcDataReader new_reader;

            try
            {
                con_obj.db_Connection_open();
                _conn = connection._conn;
                if (_conn.State == ConnectionState.Open && (_conn.State != ConnectionState.Connecting || _conn.State != ConnectionState.Executing || _conn.State != ConnectionState.Fetching))
                {
                    OdbcCommand _command_obj = new OdbcCommand(_sql_string, _conn);
                    lock (ReaderLock)
                    {
                        using (new_reader = _command_obj.ExecuteReader(CommandBehavior.CloseConnection))
                        {
                            if (new_reader.Read())
                            {
                                ret_val = Convert.ToString(new_reader[return_param]);
                            }
                        }
                        return(ret_val);
                    }
                }
                else
                {
                    return(null);
                }
            }

            catch (Exception ex)
            {
                Track_obj.Text_Tracker(Convert.ToString(ex) + return_param);
                return(null);
            }
        }
示例#2
0
 public static void connect_to_db()
 {
     DBClass.connection con_Obj = new DBClass.connection();
     con_Obj.db_Connection_open();
 }