views:

42

answers:

1

I want to select data from SqlDataSource tag to gridview using TextBox1 value.how can i modify that ASP.net code behind file..plz give me solution ASAP.thankz.................... ...........................

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
SelectCommand= "select distinct [Species],[qty],[received],[Discard],[mortility],[dispatch],[dispatch],[dpt_sales] from  [vw_getFishDtls] where [Tank_id]=TextBox1.Text and [ftype] =(select [ftype] from [vw_getFishType] where [Tank_id]=TextBox1.Text"
ConnectionString="Data Source=IT-ISHAN;Initial Catalog=ETF;User Id=ishanuk77; Password=ishanuk77;">
</asp:SqlDataSource>
A: 

If I understand, you want to use the content of textbox as a parameter for SqlDataSource.

Read this really nice tutorial:

Using Parameterized Queries with the SqlDataSource

Leniel Macaferi