Capturing SQL Recordset to Control

G

Guest

I have a SQL DataSource that returns: first name, last name, title, UserID.
I now want to capture each of these records and place them into their
corresponding textboxes on my webforms, how do I accomplish this.
thank you.
 
G

Guest

I have a SQL DataSource that returns: first name, last name, title, UserID.
I now want to capture each of these records and place them into their
corresponding textboxes on my webforms, how do I accomplish this.
thank you.

something like the following code

ASPX

ProductName = <asp:label id="lblProductName" runat="server" />
<asp:eek:bjectdatasource id="odsProducts" runat="server"
selectmethod="GetProductByProductID"
typename="NorthwindTableAdapters.ProductsTableAdapter">
<selectparameters>
<asp:parameter defaultvalue="1" name="ProductID" type="Int32" />
</selectparameters>
</asp:eek:bjectdatasource>

CODE-BEHIND

protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataView dv = (DataView)odsProducts.Select();

lblProductName.Text = dv[0]["ProductName"].ToString();
}
}
 
G

Guest

Alexey,
Will this work for Visual Web Developer Express? Im doing research on table
adapters and notice much of the objects in the instructions are not in the
menubars & tools. My apologies Im new to ASP.Net world. thanks.

Anon User said:
I have a SQL DataSource that returns: first name, last name, title, UserID.
I now want to capture each of these records and place them into their
corresponding textboxes on my webforms, how do I accomplish this.
thank you.

something like the following code

ASPX

ProductName = <asp:label id="lblProductName" runat="server" />
<asp:eek:bjectdatasource id="odsProducts" runat="server"
selectmethod="GetProductByProductID"
typename="NorthwindTableAdapters.ProductsTableAdapter">
<selectparameters>
<asp:parameter defaultvalue="1" name="ProductID" type="Int32" />
</selectparameters>
</asp:eek:bjectdatasource>

CODE-BEHIND

protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataView dv = (DataView)odsProducts.Select();

lblProductName.Text = dv[0]["ProductName"].ToString();
}
}
 

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
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top