我使用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()