Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dictionary Anomaly
Message
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Dictionary Anomaly
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01316926
Message ID:
01316926
Views:
46
Hi All, I don't know if this is a .NET problem or a SQL Server one but here goes, on startup my app populates a couple of Dictionaries with data from two tables of identical structure and field names, the data is retrieved from DataSets which in turn are populated from data in SS tables, the SP's used in the retrieval vary only in the table used ( see below )
ALTER  Proc LoadLookupData
As
Select KeyName,KeyValue
From Lookup
Order By KeyName


ALTER  Proc LoadSysparms
As
Select KeyName,KeyValue
From Sysparms
Order By KeyName
the structure for both tables is
KeyName varchar(100) not null
KeyValue varchar(500) not null
The problem I have , is , whenever I try to lookup a key value in the Dictionary populated by the SysParms table I receive a "Key not present in Dictionary" error, on closer inspection of the said Dictionaries I find: the one populated by the "Lookup" table has all of it's "Keys" trimmed whilst the other "SysParms" doesn't ! if I manually trim the "Keys" on creation of the rogue dict it works fine. I am at a loss as to why this is happening to one and not the other , my code for populating the dicts is shown below ( please trust me the DataSets are fine )
// SysMessages and SysParms are created further up the class.

static void LoadLookupData()
        {
            DataSet ds = GetDataSet("LoadLookupData",true);
            foreach (DataRow dr in ds.Tables[0].Rows)
                SysMessages.Add(dr["KeyName"].ToString(), dr["KeyValue"].ToString());   

        }

        
        static void LoadSysParms()
        {
            DataSet ds = GetDataSet("LoadSysParms", true);
            foreach (DataRow dr in ds.Tables[0].Rows)
                SysParms.Add(dr["KeyName"].ToString(), dr["KeyValue"].ToString());
        }
as always any help appreciated
Regards,
Peter J. Kane



Pete
Next
Reply
Map
View

Click here to load this message in the networking platform