Guide me How I call following function in Asp.net c#
create or replace FUNCTION AuthenticateUser(UserName IN VARCHAR2,Password IN VARCHAR2)
RETURN NUMBER
IS
Counts NUMBER;
rval Number;
BEGIN
SELECT COUNT(USERNAMES)
INTO Counts
FROM tblUsers WHERE USERNAMES = UserName AND PASSWORDS = Password;
IF Counts = 1 THEN
rval:=1;
ELSE
rval:=-1;
END IF;
RETURN(rval);
END;
I am using followin asp.net function to User Defined Funciton
public int AunthicateUser(string username, string password)
{
using (OracleConnection con = GetConnection())
{
OracleCommand cmd = new OracleCommand("SELECT * FROM AuthenticateUser(@UserName, @Password)", con);
cmd.Parameters.Add("@UserName", "username");
cmd.Parameters.Add("@Password", "password");
con.Open();
int result = (int)cmd.ExecuteNonQuery();
return result;
}
}
But I got Following error guide me.How can I solve this problem.
Oracle.DataAccess.Client.OracleException ORA-00933: SQL command not properly ended at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck) at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, Boolean bCheck) at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery() at SchoolsManagementSystem.DAL.AunthicateUser(String username, String password) in d:\c#\SchoolsManagementSystem\SchoolsManagementSystem\App_Code\DAL.cs:line 40 at SchoolsManagementSystem.Login.btnLogin_Click(Object sender, EventArgs e) in d:\c#\SchoolsManagementSystem\SchoolsManagementSystem\Login.aspx.cs:line 45
Login