Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将SQL函数值传递给ASP窗体_C#_Sql Server 2008 - Fatal编程技术网

C# 将SQL函数值传递给ASP窗体

C# 将SQL函数值传递给ASP窗体,c#,sql-server-2008,C#,Sql Server 2008,我在SQL server中创建了一个函数,如下所示,我希望获取最大ID,然后将其传递给IDtextbox中的ASP表单 我该怎么做?“如果函数有任何问题,请修复它并提供有关C#代码的建议” 如果我有另一个过程做不同的事情,我可以用同一个连接在同一时间用函数执行它吗 Alter FUNCTION [dbo].[FN_Justification_MaxGroupID] () RETURNS INT AS BEGIN Declare @MaxGroupID int SEL

我在SQL server中创建了一个函数,如下所示,我希望获取最大ID,然后将其传递给IDtextbox中的ASP表单 我该怎么做?“如果函数有任何问题,请修复它并提供有关C#代码的建议” 如果我有另一个过程做不同的事情,我可以用同一个连接在同一时间用函数执行它吗

Alter FUNCTION [dbo].[FN_Justification_MaxGroupID] ()
    RETURNS INT
AS

BEGIN

    Declare @MaxGroupID int

    SELECT  @MaxGroupID = Max([Justification_Group_ID]) +1 from [dbo].[TBL_Justification]

    RETURN  @MaxGroupID;

end

go

Declare @ID int

Select @ID= [dbo].[FN_Justification_MaxGroupID] ()

Select @ID
使用SqlCommand的ExecuteScalar()


您在这里问什么?标题为“我希望C代码从SQL Server函数中获取标量值”我给出的回答是否回答了您的问题?是的,谢谢您的支持