Re: ASP.NET Querying a database

Tech-Archive recommends: Fix windows errors by optimizing your registry



Use <asp:ControlParameter> in the .aspx page. In the code-behind,
SqlDataSource.SelectParameters collection.

"Mark Thomson" <@@@> wrote in message
news:OxMjbxujFHA.1412@xxxxxxxxxxxxxxxxxxxxxxx
In my .aspx file i have:

<form runat="server">
<asp:GridView ID="GridView1" DataSourceID="SqlDataSource1"
runat="server"/>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
SelectCommand="select authorname from authors where authorid = authorid"
ConnectionString="<%$ ConnectionStrings:Pubs %>" />
</form>


I have this code to run a query on the database.

The trouble is I don't know how to embed an authorid which is in my textbox
into the query.

in my .aspx.cs file i have:

protected void getAuthor_Click(object sender, EventArgs e)

{


}



How can i change the query so that i embed the authorid that i have got from
my textbox ?



.


Quantcast