|
If you remove it, then you'd have to keep a list elsewhere so that you can always add them later when they're up and running again. I'd just as well leave them in.
As far as checking their up-status, just try connecting to their published remoting objects that you need. If it fails, then the server's not "up". Simply pinging (which would require implementing ICMP or finding some third-party library that already has) them might not tell you enough, since many firewalls don't return pongs or reply with "destination unreachable". It's also possible that the remoting server (a Windows Services, IIS, whatever) is stopped but the server is up, so pinging it would be disjoint and wouldn't give you an accurate assessment of whether or not the remoting objects is available.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
My problem is this, i have a stored procedure in oracle,
and i which authenticates a user on the basis of loginName
and password.
the problem is that when i accesssed it through C#
giving the two parameter as input and one parameter as output.
there is no value return in output parameter.
can some on tell me how to get the output parameter value in my code
Thanks In Advance
//------------- stored procedure name is
===========SecurityPkg.Authenticate=============
PROCEDURE Authenticate(loginName IN VARCHAR2,loginPassword IN VARCHAR2, loginResult OUT INT )
IS
objectId NUMBER := -1;
objectPwd VARCHAR2(100);
passwordExpiredDate DATE;
BEGIN
Select OBJECT_ID,PASSWORD,PASSWORD_EXPIRES INTO objectId,objectPwd,passwordExpiredDate
From Application_User
Where Application_User.Login_Name=loginName;
IF(objectId = -1) THEN
loginResult := ACCOUNT_DOESNOT_EXITS;
END IF;
IF(objectPwd != loginPassword) THEN
loginResult := WRONG_PASSWORD;
End if;
IF(passwordExpiredDate < SYSDATE) THEN
loginResult := PASSWORD_EXPIRED;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
loginResult := ACCOUNT_DOESNOT_EXITS;
END Authenticate;
//------------------- csharp code that access the above stored procedure of oracle
OracleCommand cmd=new OracleCommand();
cmd.CommandText="Security_Pkg.Authenticate";
cmd.Connection=myConnection;
cmd.CommandType=CommandType.StoredProcedure;
// first param
OracleParameter loginNameParam=new OracleParameter("loginName",OracleDbType.Varchar2);
loginNameParam.Direction=ParameterDirection.Input;
loginNameParam.Value="Ali";
// 2nd param
OracleParameter loginPasswordParam=new OracleParameter("loginPassword",OracleDbType.Varchar2);
loginPasswordParam.Direction=ParameterDirection.Input;
loginPasswordParam.Value="pass";
// 3rd param
OracleParameter loginResultParam=new OracleParameter("loginResult",OracleDbType.Int16);
loginResultParam.Direction=ParameterDirection.Output;
cmd.Parameters.Add(loginNameParam);
cmd.Parameters.Add(loginPasswordParam);
cmd.Parameters.Add(loginResultParam);
cmd.ExecuteNonQuery();
Now when i check the value of loginResultParam, its null.
can any one tell me how to get its value
|
|
|
|
|
It should work, according to the documentation. I've also done this many times using the SqlClient, which works similarily (from callers' perspectives). Have you tested your stored procedure using some Oracle command execution environment? I must admit that I don't know much about Oracle (for my own personal reasons) but I know that in SQL Server you have to declare the size of your char arrays, even for parameters declared in the stored procedure, as well as the size of them when declaring your parameters to use with ADO.NET.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I believe that the problem lies in your PL/SQL code. The one thing that I notice is that you never assign a default value to the output parameter in your sproc. If none of the If conditions test true, then loginResult is returned with the database default value.
In my testing (VS.NET 2002, Oracle.DataAccess, Oracle 9i), the output parameter defaults to null regardless of data type declaration. By setting loginResult to your default success value before running the Select statement, you should get the desired result.
Hope that helps.
--Jesse
|
|
|
|
|
Try closing the connection object before you check the output parameter value. I haven't the faintest idea why, but with sql7.0 I get null for output parameters until after I call the close method on the connections...
Someone smarter than I will have to take a shot at why that might be...
Grasping...
Bill
|
|
|
|
|
need to open a form but it must be an MDIChild ie its menu bar needs to appear on the MDIparent any ideas
private void btnLogin_Click(object sender, System.EventArgs e)
{
if(CheckUser(txtUserName.Text,txtPassword.Text) == 1)
{
SalesForm frm = new SalesForm();
if(MdiParent != null)
{
MdiParent.AddOwnedForm(frm);
frm.Show();
this.Close();
}
}
else
{
throw new Exception("fart");
}
|
|
|
|
|
I'm not sure if this is what you want but check this out.
In your child form right click on the mainmenu that you have added.
Hit properties. Once you hit properties for the menu you will see
MergeType
click on this and then change it to MergeItems
This will append the menu to your parent's menu.
I hope this helps.
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
The best way to handle this problem and doing it safely is to create a delegate in the Parent, create an Event in the child, and subscribe the delegate to the event. Then when your child sees that the event for opening the second child occurs, you raise the event and pass the necessary information to be passed to the second child in the event args.
...parent...
MyChild child;
...
if (child != null)
{
child = new MyChild();
child.SomeEvent += new EventHandler(myDelegateMethod);
child.MdiParent = this;
child.Show();
}
else
child.Focus();
...
private void myDelegateMethod(object sender, MyEventArgs e)
{
INewChild something;
if (e.RequestedForm == "Calculate")
something = new Calculate(e.Args);
else
something = new SomethingElse(e.Args);
something.MdiParent = this;
something.Show();
}
...
public class MyEventArgs:System.EventArgs
...
______________________________
The Tao gave birth to machine language. Machine language gave birth to the assembler.
The assembler gave birth to the compiler. Now there are ten thousand languages.
Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao.
But do not program in COBOL if you can avoid it.
|
|
|
|
|
Is string a primitive type or is it not?
I read in Jeffrey Richter's "Applied Microsoft .NET Framework" that string (and decimal too) should be primitive types but than I tried following lines of code:
<br />
string s="";<br />
Console.WriteLine (s.GetType().IsPrimitive.ToString());<br />
It prints false!!
Do I make something false, or does anybody have an explanation for that??
mfg
|
|
|
|
|
System.String is a class.
AFAIK the pseudo-primitive type string is only a shortcut for System.String .
|
|
|
|
|
Yes, I know. int is also just a shortcut for System.Int32.
What I'm wondering about is, that Mr. Richter writes in his book, that string is a Primitive type and the command returns false at this method call. It also does with decimal datatype (decimal is no class), but it does not with int.
|
|
|
|
|
|
Thanks!! Good explanation
It says that string is no primitive type.
But another question:
This discussion also says that only on primitive types consts could be defined; but I am also able to define a string const with the following statement:
private const string cMYCONST = "asdfjkl";
????
|
|
|
|
|
As was already proven about that author, not everyone is as right as they claim to be. Whoever said that is wrong.
You can declare anything as a const that can take a literal value, such as strings and other "primative" types (value types) that don't require explicit instantiation. These are your numeric types, bool , string , and enums.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for the answer. I think I understand now a little more about those value/reference types...
Heath Stewart wrote:
As was already proven about that author, not everyone is as right as they claim to be. Whoever said that is wrong.
What do you mean with it, does Jeffrey Richter have more mistakes in his articels than it seem to be there??
|
|
|
|
|
Actually, I was referring to the comment in the discussion someone linked that said that only "primatives" could be declared as consts. The fact that Jeffrey Richter said that String was a primative (and I'm taking your word for it) would be incorrect, yes. The Framework supports that by what you saw (which, BTW, you don't need to use Boolean.ToString in Console.WriteLine , since it formats every argument - regardless of type - as a string anyway; see my article, Custom String Formatting in .NET[^] for a brief discussion, though the article's not about that so much).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I would say string is primitive as it is directly supported in the CLR. Decimal on the hand, is not.
top secret
|
|
|
|
|
Hi all...
I just back to my machine today morning after Easter vacation. Have gone thru all comments. Frankly, as of now, I don't have that much in depth idea about it to say something authentically. Thanks very much for all valuable inputs so that I can consider those to identify the truth.
rgds...mil10.
|
|
|
|
|
Hi everybody,
I visited a website about 4 or 6 months ago that was presenting a component for either .NET or COM that allowed to write Excel files programatically (not just automation, it was standalone: no need for Excel). I remember the component was quite cheap (or free, unsure) and not from one of the big component makers out there. It was pretty much one guy writing this component and sharing with others.
The problem is, I can't find the website anymore, nor do I remember the name of the thing. I bookmarked it but I deleted all my bookmarks about a month ago because I never used them (duh!)
Anyone knows what I'm talking about and can point me to the right direction? Google and Groups.Google didn't help.
Thanks a lot!
Carl
|
|
|
|
|
Try http://www.fpoint.com[^]. This is Farpoint Technologies, makers of Spread for COM and .NET, one of the best Excel-like controls that's been around for quite a while. It can open and write XLS files and handy many of Excel's embedded functions (like SUM, AVG, etc.). Many of the same features are supported, and it is relatively cheap (Spread for Windows Forms is $799).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm sure their component is nice, but at $800, it is really not in my budget.
The thing I'm looking for was either free or under $100... I don't remember exactly.
Thanks
|
|
|
|
|
It was easy to find this[^] after a quick search on the usual sites.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You may also want to have a look at XlsGen[^]. The price for a license starts around $10 USD.
--Jesse
|
|
|
|
|
GREAT!!!!!!!! That's the one I was looking for! I knew some CPIANs were smarter than me and didn't delete their bookmarks
Thanks again, this really helps!
|
|
|
|
|
Is there a c# version of this: http://www.codeproject.com/shell/shellextguide1.asp ?
Is it possible to do it in c#? Can anyone point me to a tutorial or even just briefly explain how to do it?
Thanks
|
|
|
|