这是后面的代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication9.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<p>
ID
<asp:TextBox ID="id" runat="server"></asp:TextBox>
</p>
<p>
Name
<asp:TextBox ID="name" runat="server"></asp:TextBox>
</p>
<p>
Email
<asp:TextBox ID="email" runat="server"></asp:TextBox>
</p>
<p>
Mobile
<asp:TextBox ID="mobile" runat="server"></asp:TextBox>
</p>
<p>
Date
<asp:TextBox ID="date" runat="server" TextMode="Date"></asp:TextBox>
</p>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" style="height: 26px" Text="insert" />
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Delete" />
<br />
<br />
</form>
</body>
</html>
我想要查询sql来帮助我删除用户同时插入的内容,我的意思是当用户插入数据并单击“提交”时,它将保存在我的数据库中其工作;当用户单击“删除其内容”而不删除行时,为什么?< / p>
这是数据库中sql服务器中的过程代码:
USE [MohDB]
GO
/****** Object: StoredProcedure [dbo].[Empdel] Script Date: 11/5/2018 1:03:14 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[Empdel]
@a int,
@b nvarchar(50),
@c nvarchar(50),
@d nvarchar (50),
@e date
AS
BEGIN
DELETE FROM [dbo].[EmpTbl]
WHERE EmpID=6;
END
答案 0 :(得分:2)
您没有在过程中为删除调用设置参数。您的过程已设置为默认值6。它应该像这样
ALTER PROCEDURE [dbo].[Empdel]
@a int,
@b nvarchar(50),
@c nvarchar(50),
@d nvarchar (50),
@e date
AS
BEGIN
DELETE FROM [dbo].[EmpTbl]
WHERE EmpID=@a;
END