|
As to your problem, the only thing I can think of is that you may have to convert the enum to an int, return the int to the calling application, and let the calling app convert it back to a Product enum. Here's a function I use to go back to an enum from an integer value. It ensures that enum "value" exists within the specified enum type, thereby never returning an invalid enum value.
public static T IntToEnum<t>(int value, T defaultValue)
{
T enumValue = (Enum.IsDefined(typeof(T), value)) ? (T)(object)value : defaultValue;
return enumValue;
}
</t>
The formatting thing is a site bug.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi,
I figured I could probably do something like what you've suggested but I was hoping that I wouldn't have to go down that road.
Is there any particular reason that the enum is being redefined in the generated stub for the web service? Why doesn't the web service use the definition in the class library that it references?
Thanks,
dlarkin77
|
|
|
|
|
I think the problem is that since the web service is a different binary, the calling application doesn't know what to do with the value. I make it a habit to only return intrinsic types and DataTables from web services. I convert enums to int before returning them.
Have you looked at the returned value in the debugger? You might have gotten lucky and it might already be an int .
John's 1st rule of programming: If there are several ways to accomplish the same task, the one that creates the most effort on the part of the programmer is probably to only way to do it right.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John's first rule seems to ring true. I guess I'll go with the approach you recommend. Thank very much for you help.
dlarkin77
|
|
|
|
|
The problem is that even though you have the same assembly (common.dll) on both sides, the classes are different. When WebService proxy is created at client side, Visual Studio creates new classes for all classes returned by WebService (based on WSDL).
I solved this by not using Visual Studio Web References. Instead I use WSDL.exe on client side and create the proxy class manually. After the creation is done I strip away all the class definitions that are created for parameters and convert the parameters used in web service calls to classes from common assembly. Then I include this file to the project.
For more info on WSDL, go to Web Services Description Language Tool (Wsdl.exe)[^]
Hope this helps,
Mika
|
|
|
|
|
i have one excel file & wants to insert that file with records in to data table???
can any one help me to do so????
|
|
|
|
|
Your question is not focused but the general structure can be as follows:
Open the file using an OleDbConnection (you can find the connection string at connectionstrings.com)
Read the contents into a DataTable using a SELECT * FROM [table_name]
Connect to the db you wish to export the data to
Create the table and columns
Write the table
Natza Mitzi
|
|
|
|
|
An easy way is to use FileHelpers. Check site www.filehelpers.com[^]
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
i design report with crystal report embedded in vs 2005. report work correctly in my computer and then i make setup for my application and run other computer but recive exeption : could not load file or assembly 'crystaldecision.windows.forms, version=10.2.3600.0,...
please help me
|
|
|
|
|
You need to include all referenced assemblies in your setup. As the exception says you are missing at least crystaldecision.windows.forms
|
|
|
|
|
Hello friends,
I have a question that is not completely about c# but it relates:
I am going to write an administrative program for a client-server network.
this program is for comminucating and sending the packets through network, from server to clients and viceversa.
but there is a question: for this kind of comminucations, c# is more respondent or java? which of these two languages is better for write the program? Is there any differences? What are them?
please guide me.
thanks
|
|
|
|
|
Hi,
Probably no one will say C# is better than Java or vice versa as you guess but I have been writing server/client applications for a long time and I can say that .NET IDE is very stable and .NET framework has good and easy to use server/client classes .
You can develop client/server applications very easily with .NET C#.
Good luck
zafer
|
|
|
|
|
thanks for your kind response,
may I know what kind of resources do you offer me to understand fundamentals, source code and rather articles. because those source codes I found are a bit difficult and half-explained.
thanks again
modified on Sunday, August 31, 2008 7:32 AM
|
|
|
|
|
I suggest you to buy "C# in a Nutshell" written by "Joseph albahari". The book explains some basics of network programming.
|
|
|
|
|
honestly, you may choose what language that you more understand to use, so you can manage them more easy and give fast response when errors occurred.
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
thanks again,
i'll be glad if you give me the resources of learning (articles and source codes ). I have searched for them but those I found are a bit difficult and malfomed explained. whould you give me some better ones?
modified on Sunday, August 31, 2008 7:39 AM
|
|
|
|
|
|
If the applications will never be run on Linux, write it in C#.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
thanks again,
i'll be glad if you give me the resources of learning (articles and source codes ). I have searched for them but those I found are a bit difficult and malfomed explained. whould you give me some better ones?
modified on Sunday, August 31, 2008 7:35 AM
|
|
|
|
|
Google is your friend.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I think Java is better and harder.
Sajjad Izadi wrote: Is there any differences?
By Java :
You can run your program on both of Linux and Windows.
Java is faster , faster , faster.
|
|
|
|
|
Mohammad Dayyan wrote: Java is faster , faster , faster.
Are you sure ?
Seriously, it all depends on the programmer and how efficiently the program is written. A C++ program can be very slow if it is written poorly.
|
|
|
|
|
what have you done before? or what have you done so far?
If you are a beginner learn from some tutorials before doing that.
Even not beginner download some samples here.
Good Luck
nelsonpaixao@yahoo.com.br
|
|
|
|
|
when we create a asymmetric key pair where can i find the public key, to distribute.
|
|
|
|
|
if i have a string like "100-A",i want to autoincrement it like 100-A,100-B,100-C......100-Z,100-AA,100-AB,100-AC......100-AZ,100-AAA,100-AAB
......
CAN ANY ONE HELP ME TO DO CODE FOR IT??
I ALREADY DONE CODE LIKE
public string autogenrate1(string strauto)
{
object max;
string m;
int count = 0;
max = ExecuteScalar(strauto);
if (max == System.DBNull.Value)
{
m = "100-A";
return m;
}
else
{
string n = Convert.ToString(max);
string character = "";
for(int t=0;t<n.length;t++)>
{
if (n[t] >= 'A' && n[t] <= 'Z')
count++;
}
if (count == 1)
{
for (int i = 0; i < n.Length; i++)
{
character = n.Substring(i, 1);
}
switch (character)
{
case "A": character = "B"; break;
case "B": character = "C"; break;
case "C": character = "D"; break;
case "D": character = "E"; break;
case "E": character = "F"; break;
case "F": character = "G"; break;
case "G": character = "H"; break;
case "H": character = "I"; break;
case "I": character = "J"; break;
case "J": character = "K"; break;
case "K": character = "L"; break;
case "L": character = "M"; break;
case "M": character = "N"; break;
case "N": character = "O"; break;
case "O": character = "P"; break;
case "P": character = "Q"; break;
case "Q": character = "R"; break;
case "R": character = "S"; break;
case "S": character = "T"; break;
case "T": character = "U"; break;
case "U": character = "V"; break;
case "V": character = "W"; break;
case "W": character = "X"; break;
case "X": character = "Y"; break;
case "Y": character = "Z"; break;
case "Z": character = "AA"; break;
case "AA": character = "BB"; break;
case "BB": character = "CC"; break;
case "CC": character = "DD"; break;
case "DD": character = "EE"; break;
case "EE": character = "FF"; break;
case "FF": character = "GG"; break;
case "GG": character = "HH"; break;
case "II": character = "JJ"; break;
case "JJ": character = "KK"; break;
case "KK": character = "LL"; break;
case "MM": character = "NN"; break;
case "NN": character = "OO"; break;
case "OO": character = "PP"; break;
case "PP": character = "QQ"; break;
case "QQ": character = "RR"; break;
case "RR": character = "SS"; break;
case "SS": character = "TT"; break;
case "TT": character = "UU"; break;
case "UU": character = "VV"; break;
case "VV": character = "WW"; break;
case "WW": character = "XX"; break;
case "XX": character = "YY"; break;
case "YY": character = "ZZ"; break;
}
}
else if (count == 2)
{
for (int i = 0; i < n.Length; i++)
{
character = n.Substring(i, 1);
}
switch (character)
{
case "A": character = "AB"; break;
case "B": character = "AC"; break;
case "C": character = "AD"; break;
case "D": character = "AE"; break;
case "E": character = "AF"; break;
case "F": character = "AG"; break;
case "G": character = "AH"; break;
case "H": character = "AI"; break;
case "I": character = "AJ"; break;
case "J": character = "AK"; break;
case "K": character = "AL"; break;
case "L": character = "AM"; break;
case "M": character = "AN"; break;
case "N": character = "AO"; break;
case "O": character = "AP"; break;
case "P": character = "AQ"; break;
case "Q": character = "AR"; break;
case "R": character = "AS"; break;
case "S": character = "AT"; break;
case "U": character = "AV"; break;
case "V": character = "AW"; break;
case "W": character = "AX"; break;
case "X": character = "AY"; break;
case "Y": character = "AZ"; break;
}
}
string s = "100" + "-" + character;
return s;
}
BUT IT CAN NOT PROCEED AFTER 100-AZ......
|
|
|
|