Hello, I have an ASP page that says if the ID = 13, display more HTML.
Now I want to port it to ASPX.
Here's my code:
<%@ Page Language="vb" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
' Create a connection to the "pubs" SQL database located
' on the local computer.
Dim myConnection As SqlConnection
Dim myCommand As SqlDataAdapter
dim id
id = request.querystring("id")
' Connect to the SQL database using a SQL SELECT query to get
' all the data from the table.
myConnection = New SqlConnection("server=xxxx;" _
& "database=xxxx;user id=xx;pwd=x")
myCommand = New SqlDataAdapter("SELECT * FROM products WHERE IDproduct = " & id, myConnection)
' Create and fill a DataSet.
Dim ds As Dataset = new DataSet()
myCommand.Fill(ds)
' Bind MyRepeater to the DataSet. MyRepeater is the ID of the
' Repeater control in the HTML section of the page.
mydatalist.DataSource = ds
Mydatalist.DataBind()
End Sub
</script>
<html>
<head>
</head>
<body>
<asp
ataList id="mydatalist" runat="server" Width="100%" CellPadding="3" cellspacing="3" RepeatColumns="4">
<itemtemplate>
<%# DataBinder.Eval(Container.DataItem, ("descriptionLong"))%>
</itemtemplate>
</asp
ataList>
</body>
</html>
^^^
so now i want it to say if id=13, display "hello"
anyway to do this? if i type in the browser " as example.
thanks!
asaf
Now I want to port it to ASPX.
Here's my code:
<%@ Page Language="vb" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
' Create a connection to the "pubs" SQL database located
' on the local computer.
Dim myConnection As SqlConnection
Dim myCommand As SqlDataAdapter
dim id
id = request.querystring("id")
' Connect to the SQL database using a SQL SELECT query to get
' all the data from the table.
myConnection = New SqlConnection("server=xxxx;" _
& "database=xxxx;user id=xx;pwd=x")
myCommand = New SqlDataAdapter("SELECT * FROM products WHERE IDproduct = " & id, myConnection)
' Create and fill a DataSet.
Dim ds As Dataset = new DataSet()
myCommand.Fill(ds)
' Bind MyRepeater to the DataSet. MyRepeater is the ID of the
' Repeater control in the HTML section of the page.
mydatalist.DataSource = ds
Mydatalist.DataBind()
End Sub
</script>
<html>
<head>
</head>
<body>
<asp
<itemtemplate>
<%# DataBinder.Eval(Container.DataItem, ("descriptionLong"))%>
</itemtemplate>
</asp
</body>
</html>
^^^
so now i want it to say if id=13, display "hello"
anyway to do this? if i type in the browser " as example.
thanks!
asaf