Help! C# - SqlDataSource to TextBox (asp.net)

D

deegee

Hi,

I'm new to C# and Visual Studio 2005 and very confused trying to do a
very simple thing (I think).
All I want to do is: when a page loads it runs a query on a table in a
database and displays the fields in various text boxes on the page.
I've added the SqlDataSource to the page ok; added the textbox ok; but
how do I bind the results of the query to the textbox?!?! Should be
so simple but I keep finding VS2003 examples

protected void Page_Load(object sender, EventArgs e)
{
SqlDataSource1.SelectCommand = "select name from person where
person_id = 1";
//TextBox1.Text = result of above command!!!!!!

}

I'd be very grateful for any advice/suggestions/dummies guide on how to
do this. While I'm here, can anyone recommend a good c#/asp.net book?

Thank you!!

deegee
 
N

Nanda Lella[MSFT]

Hello,

you can find more about DataBase transactions using .net with examples at
http://www.asp.net/QuickStart/howto/doc/adoplus/overviewcontents.aspx#


--------------------
From: (e-mail address removed)
Newsgroups: microsoft.public.dotnet.general
Subject: Help! C# - SqlDataSource to TextBox (asp.net)
Date: 31 Jan 2006 12:24:46 -0800
Organization: http://groups.google.com
Lines: 25
Message-ID: <[email protected]>
NNTP-Posting-Host: 84.92.58.58
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1138739091 29385 127.0.0.1 (31 Jan 2006 20:24:51 GMT)
X-Complaints-To: (e-mail address removed)
NNTP-Posting-Date: Tue, 31 Jan 2006 20:24:51 +0000 (UTC)
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8)
Gecko/20051111 Firefox/1.5,gzip(gfe),gzip(gfe)
Complaints-To: (e-mail address removed)
Injection-Info: o13g2000cwo.googlegroups.com; posting-host=84.92.58.58;
posting-account=u77Y9A0AAACjf8FIddbT6UMJE9WmXe8e
Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
ne.de!news.glorb.com!postnews.google.com!o13g2000cwo.googlegroups.com!not-fo
r-mail
Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.general:187669
X-Tomcat-NG: microsoft.public.dotnet.general

Hi,

I'm new to C# and Visual Studio 2005 and very confused trying to do a
very simple thing (I think).
All I want to do is: when a page loads it runs a query on a table in a
database and displays the fields in various text boxes on the page.
I've added the SqlDataSource to the page ok; added the textbox ok; but
how do I bind the results of the query to the textbox?!?! Should be
so simple but I keep finding VS2003 examples

protected void Page_Load(object sender, EventArgs e)
{
SqlDataSource1.SelectCommand = "select name from person where
person_id = 1";
//TextBox1.Text = result of above command!!!!!!

}

I'd be very grateful for any advice/suggestions/dummies guide on how to
do this. While I'm here, can anyone recommend a good c#/asp.net book?

Thank you!!

deegee

--

Thank You,
Nanda Lella,

This Posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Top