本文介绍了存储过程...过程或功能“寄存器"需要参数"@Fname",但未提供.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误是
................................................... ...................

过程或函数寄存器"需要未提供的参数"@Fname".




..............................
Sql部分
...............................

设置ANSI_NULLS ON
设置QUOTED_IDENTIFIER ON

更改过程[dbo].[注册]
(
@Fname varchar(50),
@Lname varchar(50),
@password varchar(50),
@EmailId varchar(50)
)
AS
插入到Euser(Euser_id,Epassword,Fname,Lname)值("@Fname","@ Lname","@ password","@ EmailId")

................................................... .
Asp.net零件
...................................................


受保护的void Reg_Click(对象发送者,EventArgs e)
{
试试
{
SqlConnection cn =新的SqlConnection(objmk.con);

cmd.Parameters.Add(新SqlParameter("@ Fname",SqlDbType.NVarChar,50)).Value = TFname.Text;
cmd.Parameters.Add(新SqlParameter("@ Lname",SqlDbType.NVarChar,50)).Value = TLname.Text;
cmd.Parameters.Add(新SqlParameter("@ password",SqlDbType.NVarChar,50)).Value = TPassword.Text;
cmd.Parameters.Add(新SqlParameter("@ EmailId",SqlDbType.NVarChar)).Value = TEmail.Text;
cmd =新的SqlCommand("Register",cn);
cmd.CommandType = CommandType.StoredProcedure;
cn.Open();
cmd.ExecuteNonQuery();
}
catch(异常g)
{
错误.Text = g.Message;
}
}

Error is
.....................................................................

Procedure or Function ''Register'' expects parameter "@Fname", which was not supplied.




..............................
Sql Part
...............................

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON

ALTER PROCEDURE [dbo].[Register]
(
@Fname varchar (50),
@Lname varchar (50),
@password varchar(50),
@EmailId varchar(50)
)
AS
insert into Euser(Euser_id,Epassword,Fname,Lname)values("@Fname","@Lname","@password","@EmailId")

...................................................
Asp.net Part
..................................................


protected void Reg_Click(object sender, EventArgs e)
{
try
{
SqlConnection cn = new SqlConnection(objmk.con);

cmd.Parameters.Add(new SqlParameter("@Fname", SqlDbType.NVarChar, 50)).Value = TFname.Text;
cmd.Parameters.Add(new SqlParameter("@Lname", SqlDbType.NVarChar, 50)).Value = TLname.Text;
cmd.Parameters.Add(new SqlParameter("@password ", SqlDbType.NVarChar, 50)).Value = TPassword.Text;
cmd.Parameters.Add(new SqlParameter("@EmailId", SqlDbType.NVarChar)).Value = TEmail.Text;
cmd = new SqlCommand("Register", cn);
cmd.CommandType = CommandType.StoredProcedure;
cn.Open();
cmd.ExecuteNonQuery();
}
catch (Exception g)
{
Error .Text =g.Message ;
}
}

推荐答案

cmd = new SqlCommand("Register", cn);
cmd.CommandType = CommandType.StoredProcedure;



然后



and then

cmd.Parameters.Add(new SqlParameter("@Fname", SqlDbType.NVarChar, 50)).Value = TFname.Text;


这篇关于存储过程...过程或功能“寄存器"需要参数"@Fname",但未提供.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 17:13