how to bind maxid from table in Label using storedprocedure...
Refer:
create procedure usp_GetMaxId
as
begin
select max(id) from table1
end
-call this store procedure
-by using command.ExecuteScalar get the vale and bind it to the Label
Thanks
Stored Procedure:
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE MaxId AS BEGIN SET NOCOUNT ON; SELECT Max(Id) From YOURTABLENAME END GO
C#:
public void docNo() { con.Open(); cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "MaxId"; var x= cmd.ExecuteScalar(); LBLy.Text = (string)x; //LBLy.Text = yy; con.Close(); }
Hope this might help !!
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.