Re: Populating a text box with a Data Adapter

Discussion in 'ASP .Net' started by Scott M., Mar 11, 2010.

  1. Scott M.

    Scott M. Guest

    Well, I would start by making the textbox markup correctly.

    You've got:

    <asp:TextBox ID="ClaimInfo" runat="server" </asp:TextBox>

    <asp:TextBox ID="PIC" runat="server" </asp:TextBox>

    And you should have:

    <asp:TextBox ID="ClaimInfo" runat="server"></asp:TextBox>

    <asp:TextBox ID="PIC" runat="server"></asp:TextBox>

    And then I'd add some code that gets the data from your DataSet and puts it
    into your Textboxes. All you've got is code that goes to the database and
    populates a DataSet - - it doesn't attempt to use that data.

    -Scott

    "JJ297" <> wrote in message
    news:...
    > I'm unable to get any data to come up/appear in my text boxes...what
    > am I doing wrong?
    >
    > I have two textboxes on Default.aspx
    >
    > <asp:TextBox ID="ClaimInfo" runat="server" </asp:TextBox>
    >
    > <asp:TextBox ID="PIC" runat="server" </asp:TextBox>
    >
    >
    > I'm bringing the values over in a querystring and wrote a stored
    > procedure to select * from the table.
    >
    > ALTER procedure [dbo].[GetClaiminfo]
    >
    > @Claiminfo char(6),
    > @PIC char(2)
    >
    > As
    >
    >
    > SELECT *
    > FROM DelayedClaim
    > WHERE claiminfo = @claiminfo and pic = @pic
    >
    > When the page loads I want these two text boxes to populate from info
    > from the database:
    >
    > <asp:TextBox ID="LAF" runat="server" </asp:TextBox>
    >
    > <asp:TextBox ID="Docpmtt" runat="server" </asp:TextBox>
    >
    >
    > Here's the page load info but nothing appears in the textboxes:
    >
    > Dim conn As New
    > Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
    > Dim cmd As New Data.SqlClient.SqlCommand
    > With cmd
    > .CommandType = Data.CommandType.StoredProcedure
    > .CommandText = "GetClaimInfo"
    > cmd.Parameters.AddWithValue("@claiminfo",
    > Integer.Parse(Request.QueryString("claiminfo")))
    > cmd.Parameters.AddWithValue("@pic",
    > (Request.QueryString("pic")))
    > .Connection = conn
    > End With
    > Dim adapter As New Data.SqlClient.SqlDataAdapter(cmd)
    >
    > Try
    > conn.Open()
    > Dim ds As New Data.DataSet
    > adapter.Fill(ds)
    >
    >
    > Finally
    > conn.Close()
    > End Try
    >
    > What am I missing? Thanks!
     
    Scott M., Mar 11, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gnarlodious
    Replies:
    4
    Views:
    17,611
    elizas
    May 5, 2010
  2. Replies:
    4
    Views:
    7,779
    sindhoor
    Oct 7, 2009
  3. Dhananjay
    Replies:
    1
    Views:
    659
    Mike Placentra II
    Dec 23, 2007
  4. Matt Davidson
    Replies:
    3
    Views:
    105
    kaeli
    Jul 23, 2004
  5. Kermit Piper
    Replies:
    1
    Views:
    89
Loading...

Share This Page