|
I am consolidating about 10 databases into one. I have ran across multiple cases in the older databases where they have a combo-box linked to a database table with under 10 items. What would be the best way to handle the small amount of data ? Do I create a strongly typed array or do I keep the 20 different tables that will never have any data added ?
|
|
|
|
|
Sounds like the tables might be holding enumeration types values. If so, they're probably anchored by foreign keys on other tables. Do they have just two columns, a key and a value?
It's a common problem, because in code you might use an enum to represent these values and you end up in the situation of how to keep the database and code in sync.
You could remove the tables, but that might render the database a bit meaningless without the application tier in place, limiting what could be achieved via a stored proc for instance. You can't really create enum types at runtime, although you could create the same effect using static members on a class.
Probably the best way would be to have them as a collection of key/value pairs.
I can't really offer a definitive answer I'm afraid, but for completeness it might be advisable to keep them.
Regards,
Rob Philpott.
|
|
|
|
|
I have jumped both way in the past, leave multiple emun tables or stick them into a single key/value table. I find the multiple table solution the best mainly for the FK constraint capability.
I also use my code generator to create the enum values in the application in a class called... Enums - go figure!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: I also use my code generator to create the enum values in the application
That has been my solution in the past too!
Avoids all that nasty ORM stuff. Also getting it to do a runtime check that things are aligned is useful, in case someone in their wisdom decides to reassign the enums..
Regards,
Rob Philpott.
|
|
|
|
|
Mycroft Holmes wrote: a single key/value table
I have only done that sort of thing once, but it's really only to provide translations when reporting.
But in general, it sounds like a bad idea if you are relying on the table for referential integrity.
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
The problem that I find with enums is you may not be adding stuff to them but what happens if you remove an item? The rest of the items move up in the numbering scheme unless you explicitly provide the values of each enum member. If you're using that value in a database, you'll be changing the meaning of all of your stored values by adding/removing a single line of code in your enum definition.
Using an auto numbering enum may look good up front, but can bite you in the ass later on when adding/removing members to them.
|
|
|
|
|
Dave Kreskowiak wrote: The rest of the items move up in the numbering scheme unless you explicitly provide the values of each enum member
You only ever get bitten by this once, then you dig into your code generator and explicitly number the items
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Fortunately this has never happened to me because I saw the problem before I even wrote any code.
Other people I've worked with in the past, however, didn't see the problem even after their applications starting crapping all over themselves. Ask them what they changed and it's always "nothing" and then 20 minutes later the truth comes out and they changed and auto enum.
Enums are very simple things to understand but yet extremely difficult for some people for some reason.
|
|
|
|
|
For what it's worth - the way I set up drop down values is in one database table.
Below is an over-simplified example.
Doing this allows me to manage all the dropdowns, irrespective of application and control, for the whole ERP system within one reference table:
id application control_name item active position
17 proj proj_cmb Tier1 1 1
18 proj proj_cmb Tier2 1 2
19 proj proj_cmb Tier3 1 3
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
That concept is seductive, I had not considered it across apps, but I like my FKs too much to do that. We do 90% of our processing in the database so that always gets first consideration, nature of the beast (not ERP).
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
As our ERP system grew, which is written in house (previously with the lead developer and me but now solely by me) we decided to split the different areas of the ERP into separate applications in order to make development/maintenance easier(the users did not appear to mind).
From the very early days I started shifting hard-coded lists, within the UI code, out into the back-end database. I have also written some tools to help me administer this database.
In practise what this means is that I can make quick changes to lists within applications without having to roll out new releases to users.
The example I gave above is an over-simplified version of what I have built.
The reference table, for lists, also allows stored procedures to be used for populating lists(with parameters being supplied from the client side) and even allows cascading dropdown design (e.g. country and state dropdowns).
This has made my life so much easier, so I can concentrate on developing new features rather than spending hours on amending the contents of dropdowns.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Thanks you guys are awesome
|
|
|
|
|
Unless there is a compelling reason to combine them, I'd keep the tables separate.
As others have also said, I can generate an enum from them. GenOmatic[^]
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
Hi All,
I use the rdcl report with c# web application and I have a 2 questions:
1. Is it possible to create the rdcl report with dynamic dataset.xsd, if yes how?
2. Is it possible to show the rows as header columns as the following:
we have Customers datatable with columns ID,Name and by default shown like this,
ID Name
1 zead
2 jan
but the customers datatable columns not have a static columns ID,Name..
it may be contains city, address, phone
(dynamic columns).
Please help me ASAP
|
|
|
|
|
|
Greetings,
I'm using a crystal report and using it to make a sales report and I want to sort the reports displayed based on the date of the sales order what I should do I create a parameter field and its type is Boolean what else I should do what is the formula to write to do such sorting
|
|
|
|
|
|
As an alternative to the other suggestion you might consider retrieving the data from the data store so it is already sorted.
|
|
|
|
|
Hey, I am trying to make an application that allows me to connect to a proxy server through a c# console application but I am not sure how.What I want to achieve is the program selects a random IP from the list in a text file and opens up google using the chosen proxy IP, I want to use it in school because the website restrictions are completely broken, most websites are blocked for either sales or occult. I've been looking around on the web and I found a few things like HttpWebRequest and HttpWebResponse but I don't know how to use it, could someone link me to a website that explains this kind of thing or explain it on here please.
I've got this but its probably completely wrong.
In ProxyIps.txt there is a large list of proxy IP addresses.
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
using System.IO;<br />
using System.Net;<br />
<br />
namespace FirstWebProxy<br />
{<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
Console.WriteLine("Available proxys:");<br />
<br />
string[] lines = System.IO.File.ReadAllLines(@"C:\Users\user0\Documents\Visual Studio 2010\Projects\FirstWebProxy\ProxyIps.txt");<br />
<br />
foreach (string line in lines)<br />
{<br />
<br />
Console.WriteLine("\t" + line);<br />
}<br />
<br />
Console.WriteLine("Would you like to connect to a random server? Type Y or N");<br />
string r = Console.ReadLine();<br />
<br />
if (r =="Y" || r =="y") {<br />
<pre lang="cs">var p = new Random();<br />
var randomLineNumber = p.Next(0, lines.Length - 1);<br />
var host = lines[randomLineNumber];<br />
<br />
string url = "http://www.google.com/";<br />
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);<br />
WebProxy myproxy = new WebProxy(host, false);<br />
request.Proxy = myproxy;<br />
request.Method = "GET";<br />
HttpWebResponse response = (HttpWebResponse)request.GetResponse();<br />
}<br />
<br />
}<br />
}<br />
}<br />
<br />
Thanks in advance.
|
|
|
|
|
Member 10521793 wrote: but its probably completely wrong. Why do you think so? What does happen instead of what you expect to happen? Any error messages? Any missing functionality?
|
|
|
|
|
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - unable to connect to remote server.And how do I open chrome using the proxy I'm requesting?
Thanks in advance.
|
|
|
|
|
Unable to connect: is the IP address of the proxy correct? Does the proxy need credentials?
Chrome: That's a question of how to configure Chrome, not a question of C# coding!
|
|
|
|
|
Hello everyone,
I am looking for script which online convert Kurti dev to uni code and uni code yo kurti dev convert by script in C#.
Please help me for the script. how to write or anyone have ready made script.
|
|
|
|
|
|
Thanks but I already checked it but it is not complete script so if you have complete script then let me know?
|
|
|
|