Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 searching using sp

Author  Topic 

cyankhan
Starting Member

7 Posts

Posted - 2008-05-29 : 17:52:14
I am trying to cretae a SP which will accept a parameter from a search box and display if the eneterd string is present in the database or not.
here is my SP

ALTER PROCEDURE dbo.StoredProcedure2

(
@searchvalue varchar(50)=NULL

)

AS
SET NOCOUNT ON
SELECT test as authorname FROM author WHERE test=@searchvalue

RETURN
the SP is working ok.

now my search interface consists of a serch button and a textebox
now my search button code is

protected void Button1_Click(object sender, EventArgs e)
{
SqlDataSource mydatasource = new SqlDataSource();
mydatasource.ConnectionString= ConfigurationManager.ConnectionStrings["TESTConnectionString1"].ToString();

mydatasource.SelectCommandType= SqlDataSourceCommandType.StoredProcedure;
mydatasource.SelectCommand = "StoredProcedure2";

mydatasource.SelectParameters.Add("searchvalue", searchbox.Text);
}
}
now how or what do i postback from so that my thing works. any help will be appreciated thanks a lot.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-05-29 : 18:07:54
Your problem appears to be with your application code, so I'm going to move your thread to a more appropriate forum.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page
   

- Advertisement -