473,385 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ASP.NET Querying a database

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 ?
Nov 19 '05 #1
1 1089
Use <asp:ControlParameter> in the .aspx page. In the code-behind,
SqlDataSource.SelectParameters collection.

"Mark Thomson" <@@@> wrote in message
news:Ox**************@TK2MSFTNGP09.phx.gbl...
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 ?

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ravi Shankar | last post by:
Hi all, I have a calendar application( like Microsoft Outlook) writtn in Java.Whenever an event is created, we can set SMS/EMAIL notification. Hence when an event is created, I am storing that...
1
by: valexena | last post by:
After a few minutes of querying the database my session disconnects abruptly. Can somebody help me and tell why can be happening? -- Posted via http://dbforums.com
1
by: Hakan Akkas | last post by:
Hello all, I need to build a search engine wherewith users can query huge Xml Documents (+/- 100 MB) in a user friendly way. The searcher shouldn't be aware of the underlying structure of the...
2
by: Elliot Rodriguez | last post by:
As I continue to read more about the benefits of database querying using ADO.NET, I am having a more difficult time distinguishing what the best approach to data retrieval is anymore. When...
1
by: radicool | last post by:
What is the User ID and Password for querying Follett's TextLink database. I am using Adaptive Server Anywhere. If this is not the best group to ask this, where would be?
6
by: Greg | last post by:
I am working on a project that will have about 500,000 records in an XML document. This document will need to be queried with XPath, and records will need to be updated. I was thinking about...
0
by: roiavidan | last post by:
Hi, I'm having a bit of a problem with a small application I wrote in C#, which uses an Access database (mdb file) for storing financial data. After looking for a similiar topic and failing to...
3
by: MDB | last post by:
I'd normally Google for a question like this, and hope to snag a few examples along with the answer, but this time I can't see to get the keywords specific enough. Or I'd ask coworkers, but...
5
by: sql_er | last post by:
Guys, I have an XML file which is 233MB in size. It was created by loading 6 tables from an sql server database into a dataset object and then writing out the contents from this dataset into an...
2
by: RajSharma | last post by:
Hi, I am facing a problem regarding querying thru a large table having millions of rows....... Its hanging in between while querying for all those rows Can anybody suggest me a query regarding :...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.