I have created a class library which generates a number everytime i use it in any other Windows application and the number gets updated everytime i use it.
public int Generate_num(string P_PRM_TYPE)
{
try
{
int v_last_no = 0;
string query = @"select PARM_VALUE from soc_parm_mast where PARM_TYPE = '" + P_PRM_TYPE + "';";
command.CommandText = query;
OleDbDataReader reader = command.ExecuteReader();
reader.Read();
v_last_no = Int32.Parse(reader["PARM_VALUE"].ToString()) + 1;
reader.Close();
command.CommandText = @"update soc_parm_mast set PARM_VALUE = PARM_VALUE+1 where PARM_TYPE = " + P_PRM_TYPE + ";";
command.ExecuteNonQuery();
return v_last_no;
}
catch(Exception exception)
{
return 404;
}
}
I am using this class in some other windows form application to generate a new no. everytime i call it.But it is not Working properly and is returning always 404.
int vTrans_no = GEN_NO.Generate_num("TRAN");