1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

DB Functions in .net

Discussion in 'Software' started by Rinjin, Apr 12, 2008.

  1. Rinjin

    Rinjin New Member

    Hello Guys....

    Thanks a ton for your suggestions... I have a database function related question... I am not sure if I can ask it here. However, if I am posting it at the wrong place, hope you will redirect me to the right location...

    I am working on a project for PDA. I have installed Oracle Lite. I wana call a database function. My code is as follows:

    Dim cmd1 As LiteCommand = con.CreateCommand()

    cmd1.CommandText = "fncEncryptPsswd"
    cmd1.CommandType = CommandType.StoredProcedure
    Dim p1 As New OracleParameter("p_input1", DbType.String)
    p1.Value = UCase(Trim(txtPsword.Text))
    p1.Direction = ParameterDirection.Input

    Dim p2 As New OracleParameter("output1", DbType.String)
    p2.Direction = ParameterDirection.ReturnValue


    It throws the error:

    37000[POL- 5228] syntax error

    I am nto sure what to do

    As an alternative I tried to convert the same function into .net.....

    Original in SQL is :

    FUNCTION Fncencryptpsswd(p_input1 IN VARCHAR2) RETURN VARCHAR2 IS
    x NUMBER := 31;
    s NUMBER := 1;
    r1 NUMBER := 29;
    r2 NUMBER := 31;
    r3 NUMBER := 93;
    ps NUMBER := 0;
    output1 VARCHAR2(100) := NULL;
    FOR s IN 1..LENGTH(p_input1) LOOP
    x := MOD((((x+TO_NUMBER(ASCII(SUBSTR(p_input1,s,1)))+ ps)*r1)+r2),r3);
    output1 := output1||CHR(x+33);
    ps := x;
    output1 := REPLACE(output1,'"','0');
    output1 := REPLACE(output1,'@','a');
    RETURN output1;
    END Fncencryptpsswd;

    Now teh one I have written in .net is :

    For s = 1 To pass.Length

    x = (((x + (Asc(pass.Substring(s, 1))) + ps) * r1) + r2)

    y = x Mod r3

    output = output & Chr(y + 33)

    ps = y
    Next s
    output = Replace(output, " ", "", "0")
    output = Replace(output, "@", "a")

    The output is totally different from teh other....

    Sombody please help me with this..................

Share This Page