CoderSource.net
Search
If Statements
Started by daz4805 at 02-13-2006 7:20 AM. Topic has 0 replies.

Print Search « Previous Thread Next Thread »
   02-13-2006, 7:20 AM
daz4805 is not online. Last active: 1/6/2006 5:52:12 PM daz4805

Top 25 Posts
Joined on 01-06-2006
Posts 3
If Statements
Hi,

I have a procedure in Oracle that gets two values and passes them back to c#. The code i have for this oracle connection is as follows: -

OracleConnection conc = new OracleConnection();
conc.ConnectionString = "User Id=darren;Password=darren;Data Source=;";
conc.Open();
OracleCommand occ = new OracleCommand();
occ.Connection = conc;
occ.CommandText = "User_Login.role_emp_select";
occ.CommandType = CommandType.StoredProcedure;
occ.Parameters.Add("USERNAME_IN", System.Data.OracleClient.OracleType.VarChar).Value = s_username;
occ.Parameters.Add("PASSWORD_IN", System.Data.OracleClient.OracleType.VarChar).Value = s_password;
occ.Parameters.Add("ROLE_OUT", System.Data.OracleClient.OracleType.VarChar, 12).Direction = ParameterDirection.ReturnValue;
occ.Parameters.Add("EMP_ID_OUT", System.Data.OracleClient.OracleType.VarChar, 6).Direction = ParameterDirection.ReturnValue;

I am then trying to use ROLE "OUT" parameter in an If statement to check that this value equals a string value that i have already declared. My If statement is formed as follwows: -

if occ.Parameters["ROLE_OUT"].Value == this.Staff)
{
Menu m = new Menu();
m.Show();
}
else if occ.Parameters["ROLE_OUT"].Value == this.Manager)
{
Menu2 m2 = new Menu2();
m2.Show();
}
else
{
Menu3 m3 = new Menu3();
m3.Show();
}

However this is failing when i try running this. Can anyone help me identify what i have done wrong?

Thanks!


   Report 
Codersource.Net » Programming » C# Programming » If Statements

MENU
Home
MFC 
C++
.Net
WIN32
Programming
Forum
My Articles
Welcome to Codersource.Net Login | Register | Faq  

Google
 

NOTES:


Thanks for visiting our CoderSource.net. This site will be improved with more articles. Interested visitors can also submit their articles through the Submit Article link.Your article will also be published after due consideration by the editor. 

© Copyright 2003. All rights on content reserved by CoderSource.net. Contact    About Us