I'm trying to generate new number with these codes.
CREATE SEQUENCE seq_fisnumarasi
START WITH 1
INCREMENT BY 1 ;
GO
First of all, I 've created a sequence.
CREATE PROCEDURE next_fis_number
AS
BEGIN
SELECT NEXT VALUE FOR seq_fisnumarasi
END
Then created this procedure.
public int GetFisNumber()
{
var rawQuery = Database.SqlQuery<int>("SELECT NEXT VALUE FOR next_fis_number;");
var task = rawQuery.SingleAsync();
int nextVal = task.Result;
return nextVal;
}
Added this to my Entity Framework Context.
txtFisNumber.Text = context.GetFisNumber().ToString();
Finally, called the "GetFisNumber()" to my form.
But, I got an error. Here: "Inner Exception 1: SqlException: Object 'next_fis_number' is not a sequence object."