Q:

Calling a PL_SQL function from inside c#

I have created a PL/SQL function and stored it in my oracle database.Now I want to call that function on clicking a button.
I am using visual studio and c#.
My humble attempt-
private void button3_Click(object sender, EventArgs e)
{
    comm = new OracleCommand();
    comm.CommandType = CommandType.StoredProcedure;
    comm.Connection = conn;
    String x1 = textBox1.Text;
    String x2 = textBox2.Text;

    comm.CommandText = "log_in";
    comm.Parameters.Add(new OracleParameter("c", OracleDbType.Varchar2, textBox1.Text, ParameterDirection.Input));
    comm.Parameters.Add(new OracleParameter("tt", OracleDbType.Varchar2, 256, ParameterDirection.ReturnValue));
    String z = comm.Parameters["z"].Value.ToString();
    comm.ExecuteNonQuery();
    if (z.Equals('1'))
    { MessageBox.Show("correct"); }
    conn.Close();
}

PL/SQL-
CREATE OR REPLACE FUNCTION log_in
(
    x IN VARCHAR2,
    y IN VARCHAR2
) RETURN VARCHAR2 AS
    match_count NUMBER;
BEGIN
    SELECT COUNT(*)
    INTO match_count
    FROM student_login
    WHERE email = x
    AND password = y;
    IF match_count = 0 THEN
        RETURN 0;
    ELSE
        RETURN 1;
    END IF;
END;

note-my data source is .NET framework data provider for oracle and the answer is for odp.net

A:

Your function has two input parameters, thus your call must also define two input parameter plus the return parameter. Method Add(OracleParameter) is possible but redundant. 
It should be like this:
comm = new OracleCommand();
comm.CommandType = CommandType.StoredProcedure;
comm.Connection = conn;

comm.CommandText = "log_in";
comm.Parameters.Add("x", OracleDbType.Varchar2, ParameterDirection.Input).Value = textBox1.Text; 
   // As far as I remember "ParameterDirection.Input" is the default, so you may skip it
comm.Parameters.Add("y", OracleDbType.Varchar2, ParameterDirection.Input).Value = textBox2.Text;
comm.Parameters.Add("ret", OracleDbType.Byte, ParameterDirection.ReturnValue);
comm.Parameters["ret"].DbType = DbType.Byte;
comm.ExecuteNonQuery();

String returnValue = comm.Parameters["ret"].Value.ToString();

Actually I never used CommandType.StoredProcedure. If the code above does not work try this one instead:
comm.CommandType = CommandType.Text;
comm.CommandText = "BEGIN :ret := log_in(:x, :y); END;";

