Gurjeet Singh

Gurjeet Singh

  • NA
  • 90
  • 94.7k

stored procedure

Jan 16 2013 7:16 AM
sir,

I am taking value from textbox1 and trying to pass that value to stored procedure. but while creating stored procedure I am getting below error


Msg 102, Level 15, State 1, Procedure proc_1, Line 8
Incorrect syntax near '@name'.


in c#

string nam = " and city='" + textbox1.Text + "'";

cmd.Parameters.AddWithValue("@name", nam );




create procedure proc_1
(
@name varchar (max)
)
as
begin
select [country] from table_name where city='delhi' @name
end

please let me know, how can I insert the textbox1 value into @name variable

Answers (31)