Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reference table syntax from a .h file
Message
From
09/07/2010 03:47:09
 
 
To
08/07/2010 16:55:54
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01471923
Message ID:
01471969
Views:
36
Hi,
I think you slipped into VFP mode :-} There's nothing like this in C#. You should use a constant (preferably in a global class where you can collect them together if you have more than one). FWIW #define in C# is purely a pre-processor directive and is only a symbol. This shows an example of both:
#define SOMETHING
class Program
{
    static void Main(string[] args)
    {
#if SOMETHING
        //Compile this code
#endif
       string s = Constants.TABLENAME_S;
    }
}

public static class Constants
{
    public static readonly string TABLENAME_S = @"\\SERVERNAME\VOLUME\FOLDER\maintable.dbf alias maintable shared";
    public static readonly int MAX_USERS = 5;
    //etc
}
But, like Craig, I'd question the wisdom of hard-coding a URI in this fashion.


>I want to put define table references in a .h file and be able to reference them in my program, but it does not seem to work.
>
>example
>
>#DEFINE _TABLENAME_S \\SERVERNAME\VOLUME\FOLDER\maintable.dbf alias maintable shared
>
>when I try to
>use _TABLENAME_S in the program it will not recognize the variable _TABLENAME_S
>
>the program does have the #include hfilename.h in it.
>
>any ideas?
Previous
Reply
Map
View

Click here to load this message in the networking platform