Please give me Parameter Examples in ASP.net 2

P

Phillip Vong

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
@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 code
so I can see how it's done.

Thanks in advance.

Phil
 
G

Guest

the following will work so long as you place it within the
<asp:SQLDataSource> tags.

<SelectParameters>
<asp:ControlParameter Name="test" ControlID="textbox1"
PropertyName="Text" />
</SelectParameters>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top