This could easily be done with a stored proc
DECLARE @invnum INT;
SELECT @invnum = MAX(InvoiceNumber) FROM InvoiceTable
@invnum = @invnum + 1
INSERT INTO InvoiceTable (InvoiceNumber) VALUES (@invnum)
RETURN @invnum
using(SqlCommand cmd = new SqlCommand("proc name", conection))
{
int invnum = (int)cmd.ExecuteScalar();
}
If the field is a number you could get the same affect by creating a autonumber field and just allowing the database to increment the value.