Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/297.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# 使用存储过程和c更新Asp.net表单#_C#_Asp.net_Sql Server - Fatal编程技术网

C# 使用存储过程和c更新Asp.net表单#

C# 使用存储过程和c更新Asp.net表单#,c#,asp.net,sql-server,C#,Asp.net,Sql Server,我是visual studio的新手,尝试使用存储过程和c更新我的web表单。我的代码中有一些问题 C#代码 存储过程 ALTER PROCEDURE update_outlines -- Add the parameters for the stored procedure here ( @title varchar(100), @code varchar(100), @instructor varchar(100), @credit

我是visual studio的新手,尝试使用存储过程和c更新我的web表单。我的代码中有一些问题

C#代码

存储过程

ALTER PROCEDURE update_outlines 
    -- Add the parameters for the stored procedure here
        (
    @title varchar(100),
    @code varchar(100),
    @instructor varchar(100),
    @credit varchar(100),
    @topic1 varchar(200),
    @topic2 varchar(200),
    @topic3 varchar(200),
    @topic4 varchar(200),
    @topic5 varchar(200)

    )

AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure here
    UPDATE outline
    SET

    [course_title]= @title,
        [instructor]=@instructor,
        [credit] =@credit,
        [topic1]=@topic1,
        [topic2]=@topic2,
        [topic3]=@topic3,
        [topic4]=@topic4,
        [topic5]=@topic5
        WHERE
        [course_code]= @code

END
GO

错误是什么????请发布错误详细信息,以便我们能够轻松地告诉解决方案您遇到异常?假设输入错误,
initial K Catalog
在发布问题时应该
initial Catalog
为什么要在代码中添加两次CommandText。在添加值之前,我会先检查连接状态是否打开:if(conn.state==ConnectionState.Closed)conn.open();
ALTER PROCEDURE update_outlines 
    -- Add the parameters for the stored procedure here
        (
    @title varchar(100),
    @code varchar(100),
    @instructor varchar(100),
    @credit varchar(100),
    @topic1 varchar(200),
    @topic2 varchar(200),
    @topic3 varchar(200),
    @topic4 varchar(200),
    @topic5 varchar(200)

    )

AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure here
    UPDATE outline
    SET

    [course_title]= @title,
        [instructor]=@instructor,
        [credit] =@credit,
        [topic1]=@topic1,
        [topic2]=@topic2,
        [topic3]=@topic3,
        [topic4]=@topic4,
        [topic5]=@topic5
        WHERE
        [course_code]= @code

END
GO