Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access ASP
|
Access ASP Using ASP with Microsoft Access databases. For Access questions not specific to ASP, please use the Access forum. For more ASP forums, please see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 15th, 2005, 02:59 PM
Friend of Wrox
 
Join Date: Mar 2005
Posts: 264
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to grap passed data and send it to db

How to grab person_id=5 value and send it to ms access database and display that record( in playerprofile.aspx?person_id=page ) i mean second page i want to do a select statment like this:

personid=request.querystring("person_id")
sql="select * from players where playerno=" & personid

and display the result . I be happy if some one show me the code of how i do this in asp.net thank

(right now the code in second page only prints the passed valu but i want it to execute a select statment)

-----------------------------------------------------------------

First page code(playerlist.aspx) :



Database connection - Bind to a Repeater control source code:

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

<script runat="server">
sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & server.mappath("/db/TENNIS DATABASE.mdb"))
dbconn.Open()
sql="SELECT * FROM players"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
dbread.Close()
dbconn.Close()
end sub
</script>

<html>
<body>

<form runat="server">
<asp:Repeater id="customers" runat="server">

<HeaderTemplate>
<table border="1" width="100%">
<tr bgcolor="#b0c4de">
<th></th>
<th>Player ID</th>
<th>Name</th>
<th>Initials</th>


</tr>
</HeaderTemplate>

<ItemTemplate>
<tr bgcolor="#f0f0f0">
<td><td><a href = "playerprofile.aspx?person_id=<%#Container.DataIte m("playerno")%>"><%#Container.DataItem("playerno") %></a></td>
<td><%#Container.DataItem("Name")%> </td>
<td><%#Container.DataItem("initials")%> </td>

</tr>
</ItemTemplate>

<FooterTemplate>
</table>
</FooterTemplate>

</asp:Repeater>
</form>

</body>
</html>

--------------------------------------------------------------

second page code ( playerprofile.aspx?person_id=5):




<%@ Page Language="VB" %>

<script Language="VB" Option="Explicit" runat="server">

               Sub Page_Load(Src as object, E as EventArgs)
        If Request.QueryString("person_id") <> "" Then

            lblText.Text = Request.QueryString("person_id")


        End If




    End Sub



</script>







<script runat="server">

</script>




<html>
<head>
 <title>ASP.NET Get vs. Post Sample from ASP 101</title>
</head>
<body>

<!--
Notice the only difference in the two forms
is the value specified in the METHOD attribute
-->

<p>
The text in the box was
<strong>&quot;<asp:Label id="lblText" runat="server" />&quot;</strong>

</p>

--------------------------------------------------------------








Similar Threads
Thread Thread Starter Forum Replies Last Post
using a sql db to send sms messages/emails Adam H-W SQL Server 2000 0 April 13th, 2006 05:46 AM
Send email & submit to DB at same time brettdalldorf ASP.NET 1.0 and 1.1 Basics 2 July 2nd, 2005 08:49 AM
How grap the passed value in URL ? method ASP.NET 1.0 and 1.1 Basics 1 June 17th, 2005 08:05 AM
How grap the passed value in select where clause method ASP.NET 1.x and 2.0 Application Design 1 June 16th, 2005 10:53 AM
form data not passed to php keng BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 September 4th, 2003 09:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.