i have a registration page in asp.net c# language, and Sql database.
In registration page there are 2 Text Box.
and database table have 3 field. id no, name , f_name.
when we inter the text box 1= "lokesh"
and TextBox2= "kumar" then how can we store in the database Id ="lokesh0001"
and the next registration time Id ="name0002"
please give me some proper method
Loading

Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Mar 5, 2015, 6:42 AM EST
I create a procedure for it...
USE [practice]
GO
/****** Object: StoredProcedure [dbo].[Insert_Value] Script Date: 3/6/2015 10:11:21 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[Insert_Value](@iid nvarchar(max)=null,@name nvarchar(max)=null,@fname nvarchar(max))
as
begin
declare @lastval int
set @lastval = (select count(iid) from testit where iid like '%'+@iid+'%')
declare @iidn nvarchar(max)
set @lastval=@lastval+1
set @iidn=@iid+'000'+ + CAST( @lastval as nvarchar(max))
insert into testit(iid,name,fname) values(@iidn,@name,@fname)
end
GO
veerendra kumar47 reputationPosted Mar 6, 2015, 11:44 PM EST
[ID] [int] IDENTITY(1,1) NOT NULL,
Above stmt is auto increment. try it. but only interger increment.
MD' Signs3 reputationPosted Mar 10, 2015, 12:48 AM EDT
Sonu Singh3 reputationPosted Mar 11, 2015, 6:43 AM EDT
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Mar 11, 2015, 8:04 AM EDT
this method is working correctly for me..
what type of error it is generating