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 ChoudharyPosted Mar 11, 2015, 12:04 PM
this method is working correctly for me..
what type of error it is generating
Sonu SinghPosted Mar 11, 2015, 10:43 AM
MD' SignsPosted Mar 10, 2015, 4:48 AM
veerendra kumarPosted Mar 7, 2015, 4:44 AM
[ID] [int] IDENTITY(1,1) NOT NULL,
Above stmt is auto increment. try it. but only interger increment.
Pankaj Kumar ChoudharyPosted Mar 5, 2015, 11:42 AM
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