vineet pathak

vineet pathak

  • NA
  • 254
  • 0

stored procedure

May 27 2010 1:38 AM

Hi all
I am using stored procedure to search within crystal reports.I have used the code as follows.On search button click I have written:
//Search_button click//
SqlConnection
con = new SqlConnection("Data Source=server;Initial Catalog=CR;User ID=uttam;Password=uttam");
SqlCommand cmd = new SqlCommand("spSearch",con);
cmd.Parameters.Add(
"@search1", SqlDbType.VarChar).Value = TextBox1 .Text;
cmd.Parameters.Add(
"@search2", SqlDbType.VarChar).Value = TextBox2 .Text;
cmd.CommandType =
CommandType.StoredProcedure;
con.Open();
cmd.ExecuteNonQuery();
con.Close();

//stored procedure//
CREATE
PROCEDURE spSearch
(

@Search1
varchar(50),
@Search2
varchar(50)
)

AS
BEGIN
SET
NOCOUNT ON;
-- Insert statements for procedure here

SELECT
*
FROM
cr2 Where FirstName = @search1 and LastName= @search2
END
 
Now the issue is the changes are not been r eflected in the report viewer.is there anything that I am missing or I ahve to include in my code.
Its urgent Please reply
Thanks
Vineet

Answers (3)