Click here to Skip to main content
15,902,114 members
Home / Discussions / C#
   

C#

 
Questionhashtable limitation? Pin
Jassim Rahma16-Jun-10 22:05
Jassim Rahma16-Jun-10 22:05 
AnswerMessage Closed Pin
16-Jun-10 22:33
stancrm16-Jun-10 22:33 
GeneralRe: hashtable limitation? Pin
Jassim Rahma16-Jun-10 22:36
Jassim Rahma16-Jun-10 22:36 
GeneralMessage Closed Pin
16-Jun-10 22:39
stancrm16-Jun-10 22:39 
GeneralRe: hashtable limitation? Pin
Jassim Rahma16-Jun-10 22:43
Jassim Rahma16-Jun-10 22:43 
AnswerRe: hashtable limitation? Pin
Łukasz Nowakowski16-Jun-10 22:52
Łukasz Nowakowski16-Jun-10 22:52 
AnswerRe: hashtable limitation? Pin
Luc Pattyn17-Jun-10 1:59
sitebuilderLuc Pattyn17-Jun-10 1:59 
GeneralRe: hashtable limitation? Pin
Jassim Rahma17-Jun-10 4:06
Jassim Rahma17-Jun-10 4:06 
i did all that but it's still not working... it's actually existing the while loop when it reaches count 19 with no errors as if my total count in the database table is 19 only!!

any duplicates in the table? that was your question? no, duplicates, I already checked and I have also copied the entire table as excel format in this link:

system_parameters table[^]


this is my full code which I am using:

public void get_system_properties()
{
    try
    {
_system_parameters_hash = new Hashtable();

_system_parameters_hash.Add("SQL_SERVER_CONNECTION", null);
_system_parameters_hash.Add("SQL_SERVER_DATABASE", "Cure");
_system_parameters_hash.Add("EVENT_LOG_DESCRIPTION", null);

_system_parameters_hash["SQL_SERVER_CONNECTION"] = "Data Source=";
_system_parameters_hash["SQL_SERVER_CONNECTION"] += cure_registry_current_user.GetValue("SQLServer").ToString();
_system_parameters_hash["SQL_SERVER_CONNECTION"] += ";initial catalog=";
_system_parameters_hash["SQL_SERVER_CONNECTION"] += cure_registry_current_user.GetValue("SQLDatabase").ToString();
_system_parameters_hash["SQL_SERVER_CONNECTION"] += ";User Id=";
_system_parameters_hash["SQL_SERVER_CONNECTION"] += cure_registry_current_user.GetValue("SQLUser").ToString();
_system_parameters_hash["SQL_SERVER_CONNECTION"] += ";Password=";
_system_parameters_hash["SQL_SERVER_CONNECTION"] += cure_registry_current_user.GetValue("SQLPassword").ToString();
_system_parameters_hash["SQL_SERVER_CONNECTION"] += ";Connection Timeout=";
_system_parameters_hash["SQL_SERVER_CONNECTION"] += cure_registry_current_user.GetValue("SQLTimeout").ToString();

sql_connection = new SqlConnection((string)_system_parameters_hash["SQL_SERVER_CONNECTION"]);
sql_connection.Open();
sql_command = new SqlCommand("sp_get_system_parameters", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
sql_reader = sql_command.ExecuteReader();

while (sql_reader.Read())
{
    if (_system_parameters_hash.ContainsKey(sql_reader["system_param_name"])) return;

    if (sql_reader["system_param_value"] == DBNull.Value)
    {
_system_parameters_hash.Add(sql_reader["system_param_name"].ToString(), null);
    }
    else
    {
if ((string)sql_reader["system_param_type"] == "bit") _system_parameters_hash.Add((string)sql_reader["system_param_name"], Convert.ToBoolean(sql_reader["system_param_value"]));
else if ((string)sql_reader["system_param_type"] == "string") _system_parameters_hash.Add((string)sql_reader["system_param_name"], (string)sql_reader["system_param_value"]);
else if ((string)sql_reader["system_param_type"] == "int") _system_parameters_hash.Add((string)sql_reader["system_param_name"], Convert.ToInt32(sql_reader["system_param_value"]));
else if ((string)sql_reader["system_param_type"] == "int64") _system_parameters_hash.Add((string)sql_reader["system_param_name"], Convert.ToInt64(sql_reader["system_param_value"]));
else if ((string)sql_reader["system_param_type"] == "short") _system_parameters_hash.Add((string)sql_reader["system_param_name"], Convert.ToInt16(sql_reader["system_param_value"]));
    }
}

Trace.Write(_system_parameters_hash.Count);
    }
    catch (Exception exp)
    {
create_event("System", "Error populating system properties!!", exp, EventLogEntryType.Error, 1000, false);
MessageBox.Show("Error populating system properties!!" + Environment.NewLine + "Please contact your system administrator.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
    }
    finally
    {
if (sql_reader != null) sql_reader.Close();
if (sql_connection != null)
{
    if (sql_connection.State == ConnectionState.Open)
sql_connection.Close();
}
    }
}

GeneralRe: hashtable limitation? Pin
Luc Pattyn17-Jun-10 4:14
sitebuilderLuc Pattyn17-Jun-10 4:14 
GeneralRe: hashtable limitation? Pin
Jassim Rahma17-Jun-10 4:17
Jassim Rahma17-Jun-10 4:17 
GeneralRe: hashtable limitation? Pin
Luc Pattyn17-Jun-10 4:21
sitebuilderLuc Pattyn17-Jun-10 4:21 
QuestionPng Image Saving the original size doubles Pin
VCsamir16-Jun-10 21:39
VCsamir16-Jun-10 21:39 
AnswerRe: Png Image Saving the original size doubles Pin
Luc Pattyn17-Jun-10 2:04
sitebuilderLuc Pattyn17-Jun-10 2:04 
Questionsearch in dataview without filtering Pin
sana_2616-Jun-10 21:13
sana_2616-Jun-10 21:13 
AnswerRe: search in dataview without filtering Pin
Bigdeak16-Jun-10 23:56
Bigdeak16-Jun-10 23:56 
Questionhow to get the methods registered with an eventhandler Pin
prasadbuddhika16-Jun-10 20:06
prasadbuddhika16-Jun-10 20:06 
AnswerMessage Closed Pin
16-Jun-10 21:31
stancrm16-Jun-10 21:31 
GeneralRe: how to get the methods registered with an eventhandler Pin
prasadbuddhika17-Jun-10 19:21
prasadbuddhika17-Jun-10 19:21 
QuestionNaming Controls Pin
SajjadZare16-Jun-10 18:47
SajjadZare16-Jun-10 18:47 
AnswerRe: Naming Controls Pin
Peace ON16-Jun-10 21:11
Peace ON16-Jun-10 21:11 
AnswerRe: Naming Controls Pin
Luc Pattyn17-Jun-10 2:06
sitebuilderLuc Pattyn17-Jun-10 2:06 
GeneralRe: Naming Controls Pin
SajjadZare17-Jun-10 6:01
SajjadZare17-Jun-10 6:01 
AnswerRe: Naming Controls Pin
yu-jian27-Jun-10 10:19
yu-jian27-Jun-10 10:19 
QuestionAssembelys Pin
future383916-Jun-10 15:20
future383916-Jun-10 15:20 
QuestionPerformance framework \ utility Pin
Berlus16-Jun-10 10:31
Berlus16-Jun-10 10:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.