sqlcommand chk = new ("select Count(*) FROM tb_member",conn);
int tamp = convert.toint32(chk.excutescalar());
if(tamp == 0)
{
label1.text = A0001
}
else
{
sqlcomand chkmax = new ("SELECT MAX(ID) FROM tb_member",conn);
int newid = convert.toint32(chkmax.excutescaler().replase('A',''));
newid++
label1.text = "A" + newid.tostring("0000");
CREATE PROCEDURE [dbo].[MemberGenerate]
AS
BEGIN
SELECT 'A' + RIGHT('0000' + CAST(ISNULL(MAX(SUBSTRING(Code,2,4)),0) + 1 AS VARCHAR),4) as Code
FROM dbo.Member
END