将id值添加到ecaxtly id列中

时间:2017-06-13 07:43:49

标签: c# sql visual-studio mysql-management

我使用SQL Managment Studio连接我的数据库,并尝试使用存储过程在Windows应用程序中添加一些行。 每当我添加一行时,id值会添加到屏幕截图中显示的新column1中。我该如何解决?

dataGridView1.Columns["id"].ReadOnly = true;

存储过程:

USE [schedule]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_insertProduct]
    @date date,
    @less_n int,
    @teacher nchar,
    @room int,
    @gr int,
    @subject nchar
AS
    INSERT INTO dbo.main(date, less_n, teacher, room, gr, subject) VALUES
    (@date, @less_n, @teacher, @room, @gr, @subject)
    SELECT SCOPE_IDENTITY()

Screenshoot

0 个答案:

没有答案