Results 1 to 2 of 2

Thread: How to output a record in to a form text box ?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Talking How to output a record in to a form text box ?

    How to output a record in to a form text boxes for update purpuse(just linke online editing).This is my code that displays 2 diffrent records from two diffrient tables.

    this part prints out record from fist table
    <aspataGrid id="DataGrid1" runat="server" />
    and

    This part prints out record from second table
    <aspataGrid id="DataGrid2" runat="server" />

    I want the record fields to be printed
    in two seperate form text boxes for purpuse of updateing and then submitting it back to db. I be happy if some help me medify this code
    Thanks

    <%@ Page enableViewState="False" Language="VB" debug="true"%>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.OLEDB" %>

    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.OleDb" %>



    <script language="vb" runat="server">
    Sub Page_Load(Sender As Object, E as EventArgs)
    Dim objConnection As OleDbConnection
    Dim objCommand As OleDbDataAdapter
    Dim strConnect As String
    Dim strCommand As String
    Dim DataSet1 As New DataSet

    strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;"
    strConnect += "Data Source=C:\Inetpub\wwwroot\"
    strConnect += "db\"
    strConnect += "\TENNIS DATABASE.mdb;"
    strConnect += "Persist Security Info=False"

    Response.Write("Viewing Player Record No:" +Request.QueryString("person_id")+"")


    strCommand = "SELECT * FROM players where playerno = " +Request.QueryString("person_id")+";"
    objConnection = New OleDbConnection(strConnect)
    objCommand = New OleDbDataAdapter(strCommand, objConnection)
    objCommand.Fill(DataSet1, "players")
    DataGrid1.DataSource=DataSet1.Tables("players").DefaultView
    DataGrid1.DataBind()

    'second select


    Dim strCommand2 As String
    Dim DataSet2 As New DataSet

    strCommand2 = "SELECT * FROM PENALTIES where playerno = " +Request.QueryString("person_id")+";"
    objConnection = New OleDbConnection(strConnect)
    objCommand = New OleDbDataAdapter(strCommand2, objConnection)
    objCommand.Fill(DataSet2, "PENALTIES")
    DataGrid2.DataSource=DataSet2.Tables("PENALTIES").DefaultView
    DataGrid2.DataBind()
    end sub
    </script>


    <html>
    <head>
    <title>Data Grid Control example</title>
    </head>
    <body>
    <aspataGrid id="DataGrid1" runat="server" />
    <br>
    <br>

    <aspataGrid id="DataGrid2" runat="server" />






    </body>
    </html>

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How to output a record in to a form text box ?

    What value do you want in the textbox?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width