473,387 Members | 1,703 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,387 software developers and data experts.

Capturing SQL Recordset to Control

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.
Mar 1 '07 #1
2 1061
On Mar 1, 10:19 pm, Bret <B...@discussions.microsoft.comwrote:
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:objectdatasource id="odsProducts" runat="server"
selectmethod="GetProductByProductID"
typename="NorthwindTableAdapters.ProductsTableAdap ter">
<selectparameters>
<asp:parameter defaultvalue="1" name="ProductID" type="Int32" />
</selectparameters>
</asp:objectdatasource>

CODE-BEHIND

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

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

Mar 1 '07 #2
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.

"Alexey Smirnov" wrote:
On Mar 1, 10:19 pm, Bret <B...@discussions.microsoft.comwrote:
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:objectdatasource id="odsProducts" runat="server"
selectmethod="GetProductByProductID"
typename="NorthwindTableAdapters.ProductsTableAdap ter">
<selectparameters>
<asp:parameter defaultvalue="1" name="ProductID" type="Int32" />
</selectparameters>
</asp:objectdatasource>

CODE-BEHIND

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

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

Mar 1 '07 #3

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

Similar topics

25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
3
by: sparks | last post by:
They have a new data collection station. The people here are using access 97.... This third party site will only post data back to us when we do this. ...
1
by: Jonah Olsson | last post by:
Hello, I'm trying to build an "add-on" to an already existing custom web user control. The old control collects some user data and saves it to a database. The new control should collect some...
2
by: Andrew | last post by:
Hi, I have a problem capturing the checkboxes that are checked, I get false irrespective of wether they are checked or not. I have gone thru the sample code on this forum, but they dun seem to...
10
by: Andrew | last post by:
Hi, I have a messagebox that pops up due to an event. I did it in javascript. ie. alert("Time's up. Assessment Ended"); I want to capture the OK and Cancel events of this alert messagebox. My...
5
by: slowmotiongenius | last post by:
All- I have established an adodb recordset in my code-behind, and I need to pass it to the aspx file. I can't seem to figure out if there is a way to do this. I see you can pass a string over...
2
by: senfo | last post by:
Hello all, To help alleviate human error, I'm developing an application that uses a barcode reader to fill in a value in a TextBox control. The barcode reader is connected to the PC through the...
3
by: rajibnsu | last post by:
While searching for capturing video with a webcam I god the following code.It gives two errors.Says:The type or namespace name 'WebcamEventArgs' does not exit in the namespace 'WebCam_Capture' (are...
1
by: - Electronic.HR - | last post by:
So, my problem is that i have to get picture from this site (the one with code on it), but I can't figure out how to do that. Picture is generated from php code, and I can't find way to save that...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.