<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Data Access and ObjectDataSource Control</title><link>http://forums.asp.net/23.aspx</link><description>Questions and discussions related to using ADO.NET for data access, and the ObjectDataSource control. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=9&amp;c=17" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Fetching Data from existing tables into the textboxes</title><link>http://forums.asp.net/thread/3274540.aspx</link><pubDate>Sat, 04 Jul 2009 10:17:59 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274540</guid><dc:creator>vinz</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274540.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=23&amp;PostID=3274540</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;Learning++:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;/p&gt;&lt;p&gt;Hello vinz&lt;/p&gt;
&lt;p&gt;Can you please tell me where to initialise ddldropdownlist1.&amp;nbsp;Is it converting the fields in the column into the dropdown.&lt;/p&gt;&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;&lt;p&gt;Just grab a DropDownList from the Visual Studio toolbox and then put it in the WebForm.. from there you can generate the SelectedIndexChanged event by double clicking on the DropDownList..&lt;/p&gt;&lt;p&gt;Also, I would suggest you to refer to the links that I have provided above and I&amp;#39;m sure you will get some useful information there..&lt;br /&gt;&lt;/p&gt;&lt;p&gt;You may check this example below:&lt;/p&gt;&lt;p&gt;&lt;a href="http://geekswithblogs.net/dotNETvinz/archive/2009/02/24/binding-dropdownlist-listbox-and-checkboxlist-control-the-ado.net-way.aspx"&gt;Binding DropDownList, ListBox and CheckBoxList Control the ADO.NET way.&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Fetching Data from existing tables into the textboxes</title><link>http://forums.asp.net/thread/3273804.aspx</link><pubDate>Fri, 03 Jul 2009 16:03:53 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273804</guid><dc:creator>mudassarkhan</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273804.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=23&amp;PostID=3273804</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;See if you can get something from here&lt;/p&gt;
&lt;p&gt;It has both Dropdown and TextBox&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.aspsnippets.com/post/2009/06/07/DataBinding-DropDownList-Label-and-Textbox-Controls-in-ASPNet.aspx"&gt;http://www.aspsnippets.com/post/2009/06/07/DataBinding-DropDownList-Label-and-Textbox-Controls-in-ASPNet.aspx&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Re: Fetching Data from existing tables into the textboxes</title><link>http://forums.asp.net/thread/3273784.aspx</link><pubDate>Fri, 03 Jul 2009 15:46:08 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273784</guid><dc:creator>hans_v</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273784.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=23&amp;PostID=3273784</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;You can do this easy with no code at all!!!&lt;/p&gt;
&lt;p&gt;Recently, I answered on a similir question with a a complete example:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://forums.asp.net/t/1441766.aspx#3267613"&gt;http://forums.asp.net/t/1441766.aspx#3267613&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Fetching Data from existing tables into the textboxes</title><link>http://forums.asp.net/thread/3273407.aspx</link><pubDate>Fri, 03 Jul 2009 11:34:42 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273407</guid><dc:creator>Learning++</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273407.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=23&amp;PostID=3273407</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt;protected void ddldropdownlist1_SelectedIndexChanged(object sender, EventArgs e)
    {
        GetData(ddldropdownlist1.SelectedItem.Value);
    } &lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;Hello vinz&lt;/p&gt;
&lt;p&gt;Can you please tell me where to initialise ddldropdownlist1.&amp;nbsp;Is it converting the fields in the column into the dropdown. If it is so, where to initialise it.&lt;/p&gt;
&lt;p&gt;below is my code:&lt;/p&gt;
&lt;p&gt;.aspx :&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt;&amp;lt;asp:TextBox ID=&amp;quot;txtVendorID&amp;quot;  MaxLength=&amp;quot;100&amp;quot; runat=&amp;quot;server&amp;quot; SkinID=&amp;quot;TextBox&amp;quot; &amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;/pre&gt;&lt;pre class="c-sharp" name="code"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="c-sharp" name="code"&gt;.cs :&lt;/pre&gt;&lt;pre class="c-sharp" name="code"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="c-sharp" name="code"&gt;&lt;pre class="c-sharp" name="code"&gt;private void GetData(string vendorID)
    {
        DataTable dt = new DataTable();
        using (SqlConnection Connection = new SqlConnection(@&amp;quot;Data Source=.;Initial Catalog=VendorDatabaseAdministration;User Id=ADMIN;pwd=0000&amp;quot;))
        {
            Connection.Open();
            SqlCommand sqlCmd = new SqlCommand(&amp;quot;SELECT * FROM VendorGeneralDescription WHERE [Vendor ID]= @VendorID&amp;quot;, Connection);
            SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd);
            sqlCmd.Parameters.AddWithValue(&amp;quot;@VendorID&amp;quot;, txtVendorID.Text);
            sqlDa.Fill(dt);
            if (dt.Rows.Count &amp;gt; 0)
            {
                txtVendorID.Text = dt.Rows[0][&amp;quot;[Vendor ID]&amp;quot;].ToString(); //Where ColumnName is the Field from the DB that you want to display
            }
            Connection.Close();
        }
    }

    protected void ddldropdownlist1_SelectedIndexChanged(object sender, EventArgs e)
    {
        GetData(ddldropdownlist1.SelectedItem.Value);
    } &lt;/pre&gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Fetching Data from existing tables into the textboxes</title><link>http://forums.asp.net/thread/3273372.aspx</link><pubDate>Fri, 03 Jul 2009 11:14:35 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273372</guid><dc:creator>vinz</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273372.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=23&amp;PostID=3273372</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;Learning++:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;I am using Webforms. How can i apply this in it.&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;&lt;p&gt;You can put the codes that I have provided above in the Code Behind ASPX.CS or ASPX.VB file&amp;nbsp; of the WebForm (ASPX)...&lt;/p&gt;&lt;p&gt;If you are new to ASP.NET then I would suggest you to start looking at these links below:&lt;/p&gt;&lt;p&gt;
Get Started:&amp;nbsp;&amp;nbsp; &lt;a href="http://www.asp.net/get-started/"&gt;http://www.asp.net/get-started/&lt;/a&gt;&lt;br /&gt;Learn:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="http://www.asp.net/learn/"&gt;http://www.asp.net/learn/&lt;/a&gt;&lt;br /&gt;Videos:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="http://www.asp.net/learn/videos/"&gt;http://www.asp.net/learn/videos/&lt;/a&gt;&lt;br /&gt;Data Access:&amp;nbsp; &lt;a href="http://www.asp.net/learn/videos/"&gt;http://www.asp.net/learn/data-access/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Fetching Data from existing tables into the textboxes</title><link>http://forums.asp.net/thread/3273349.aspx</link><pubDate>Fri, 03 Jul 2009 10:58:23 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273349</guid><dc:creator>Learning++</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273349.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=23&amp;PostID=3273349</wfw:commentRss><description>&lt;p&gt;Hello Vinz&lt;/p&gt;
&lt;p&gt;Thanks for replying !&lt;/p&gt;
&lt;p&gt;I am using Webforms. How can i apply this in it.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Fetching Data from existing tables into the textboxes</title><link>http://forums.asp.net/thread/3273338.aspx</link><pubDate>Fri, 03 Jul 2009 10:50:13 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273338</guid><dc:creator>vinz</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273338.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=23&amp;PostID=3273338</wfw:commentRss><description>&lt;p&gt;Here&amp;#39;s an example using the ADO.NET way with DataTable:&lt;/p&gt;&lt;p&gt;C#:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre name="code" class="c-sharp"&gt;private void GetData(string vendorID)
{
    DataTable dt = new DataTable();
    SqlConnection connection = new SqlConnection(&amp;quot;YOUR CONNECTION STRING HERE&amp;quot;);
    connection.Open();
    SqlCommand sqlCmd = new SqlCommand(&amp;quot;SELECT * FROM TABLE1 WHERE VendorID= @VendorID&amp;quot;, connection);
    SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd);
    sqlCmd.Parameters.AddWithValue(&amp;quot;@VendorID&amp;quot;,vendorID);
    sqlDa.Fill(dt);
    if (dt.Rows.Count &amp;gt; 0)
    {
           TextBox1.Text = dt.Rows[0][&amp;quot;ColumnName1&amp;quot;].ToString(); //Where ColumnName is the Field from the DB that you want to display
    }
        connection.Close();
}

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
        GetData(DropDownList1.SelectedItem.Value);
} &lt;/pre&gt;&lt;p&gt;&lt;br /&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;VB.NET:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre name="code" class="vb.net"&gt;Private Sub GetData(ByVal vendorID As String)
    Dim dt As New DataTable()
    Dim connection As New SqlConnection(&amp;quot;YOUR CONNECTION STRING HERE&amp;quot;)
    connection.Open()
    Dim sqlCmd As New SqlCommand(&amp;quot;SELECT * FROM TABLE1 WHERE VendorID= @VendorID&amp;quot;, connection)
    Dim sqlDa As New SqlDataAdapter(sqlCmd)
    sqlCmd.Parameters.AddWithValue(&amp;quot;@VendorID&amp;quot;, vendorID)
    sqlDa.Fill(dt)
    If dt.Rows.Count &amp;gt; 0 Then
            &amp;#39;Where ColumnName is the Field from the DB that you want to display
        TextBox1.Text = dt.Rows(0)(&amp;quot;ColumnName1&amp;quot;).ToString()
    End If
    connection.Close()
End Sub

Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
    GetData(DropDownList1.SelectedItem.Value)
End Sub
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt; &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Fetching Data from existing tables into the textboxes</title><link>http://forums.asp.net/thread/3272987.aspx</link><pubDate>Fri, 03 Jul 2009 07:54:28 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3272987</guid><dc:creator>Learning++</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3272987.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=23&amp;PostID=3272987</wfw:commentRss><description>&lt;p&gt;Hello Friends&lt;/p&gt;
&lt;p&gt;Please help me on this. I need to fetch data into empty text boxes from a database. Lets say, I have a vendor general info. table, where&amp;nbsp;Vendor ID. is the primary key.&amp;nbsp;first i have to choose a Vendor &amp;nbsp;ID( may be dropdown list, which is also coming from database). As soon as i choose a ID, the values in the other user controls(text boxes)&amp;nbsp;on the page, like Vendor First Name, Last Name are updated from the database.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks in Advance !&lt;/p&gt;</description></item></channel></rss>