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 = <!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/archive/index.php/">http://www.webdeveloper.com/forum/archive/index.php/</a><!-- m -->"playerprofile.aspx?person_id=<%#Container.DataItem("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>"<asp:Label id="lblText" runat="server" />"</strong>
</p>
--------------------------------------------------------------Moved to .NET forum.
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 = <!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/archive/index.php/">http://www.webdeveloper.com/forum/archive/index.php/</a><!-- m -->"playerprofile.aspx?person_id=<%#Container.DataItem("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>"<asp:Label id="lblText" runat="server" />"</strong>
</p>
--------------------------------------------------------------Moved to .NET forum.