简体   繁体   English

使用c#.net在网页中将值动态插入数据库中

[英]inserting values into database dynamically in web page using c# .net

I have got to insert employee details in EditProfile page of my project, it should be like the employee who logs in can edit his profile and insert the details and once he inserts, data will get stored in database and next time he/she logs in, their details should get displayed in the home page depending on their respective user id and password. 我必须在项目的EditProfile页面中插入员工详细信息,这就像登录的员工可以编辑其个人资料并插入详细信息,一旦他插入,数据将存储在数据库中,下次他/她登录,则其详细信息应根据其各自的用户ID和密码显示在主页上。

I have done most of the things, but im not able to get the employee name while inserting the data in edit profile... I mean to say that if one employee logs in and edits his/her profile, data gets saved in the database but not with the respective employee's name. 我已经完成了大多数事情,但是在将数据插入编辑配置文件时无法获取员工姓名...我的意思是说,如果一位员工登录并编辑其配置文件,则数据将保存在数据库中但没有员工各自的姓名。

I have tried a stored procedure to insert the values to employee data but I don't know where to use employee name in that. 我尝试了一个存储过程,将值插入到员工数据中,但是我不知道在哪里使用员工名。

Below is my stored procedure: 下面是我的存储过程:

ALTER PROCEDURE [dbo].[InsertProfile]
    @Full_Name nvarchar(50),
    @Add nvarchar(50),
    @M_Num bigint,
    @Mail_ID nvarchar(50),
    @B_Group nvarchar(50),

    @EmpID bigint OUTPUT

    AS

    Insert Into dbo.EmployeeData
    (
     FullName,
     Address,
     MobileNumber,
     EmailID,
     BloodGroup
    )
    Values 
    (@Full_Name,
     @Add,
     @M_Num,
     @Mail_ID,
     @B_Group
    )
    Select @EmpID = SCOPE_IDENTITY();
ALTER PROCEDURE [dbo].[UpdateProfile]

@FullName nvarchar(50),
@Address nvarchar(50),
@MobileNumber bigint,
@EmailID nvarchar(50),
@BloodGroup nvarchar(50),
@EmpName nvarchar(50)

AS


Update dbo.EmployeeData

Set FullName = @FullName,
Address = @Address,
MobileNumber = @MobileNumber,
EmailID = @EmailID,
BloodGroup = @BloodGroup


Where EmpName = @EmpName;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM