Thursday, March 29, 2012

Please give me Parameter Examples in ASP.net 2

Please some one help me. I'm trying to learn something very very simple and
I just have to see how it's done. If you're using VS2005 or VWD, please
create this very simple asp.net page for me and just past the whole source
code so I can see how it's done.
This is all i want to do.
DB = SQL northwind
Table = Customer
Column = Contact Name
One Textbox = textbox1 with default value of "c"
I just want to see how you can pass a variable to the Select using Like
that contains the value in the textbox1.text. The result will show on a
simple GridView. I know I basically have to do it with parameters and I've
read a lot and tried a lot and can not get it to work. This is the Select
from VS2005. Can someone tell me if this is correct? My peramter name is
@dotnet.itags.org.test. The SQLDataSource is fine.
SelectCommand="SELECT [ContactName] FROM [Customers] WHERE ([ContactName]
LIKE '%' + @dotnet.itags.org.test + '%')"
Please please please create this simple aspx and paste the whole source code
so I can see how it's done.
Thanks in advance.
Philthe following will work so long as you place it within the
<asp:SQLDataSource> tags.
<SelectParameters>
<asp:ControlParameter Name="test" ControlID="textbox1"
PropertyName="Text" />
</SelectParameters>
"Phillip Vong" wrote:

> Please some one help me. I'm trying to learn something very very simple a
nd
> I just have to see how it's done. If you're using VS2005 or VWD, please
> create this very simple asp.net page for me and just past the whole source
> code so I can see how it's done.
> This is all i want to do.
> DB = SQL northwind
> Table = Customer
> Column = Contact Name
> One Textbox = textbox1 with default value of "c"
> I just want to see how you can pass a variable to the Select using Like
> that contains the value in the textbox1.text. The result will show on a
> simple GridView. I know I basically have to do it with parameters and I'v
e
> read a lot and tried a lot and can not get it to work. This is the Select
> from VS2005. Can someone tell me if this is correct? My peramter name is
> @.test. The SQLDataSource is fine.
> SelectCommand="SELECT [ContactName] FROM [Customers] WHERE ([ContactName]
> LIKE '%' + @.test + '%')"
> Please please please create this simple aspx and paste the whole source co
de
> so I can see how it's done.
> Thanks in advance.
> Phil
>
>
>
underprocessable

0 comments:

Post a Comment