javascript


S

sara

Hi,
I have a little problem.
This is the code one of my page. My problem is that the function
"leggi1" is not executed. Where do I make a mistake?

<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="Homepage.aspx.vb" Inherits="Homepage" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Data.SqlClient" %>


<html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<title>Homepage</title>

<script language=javascript>
function leggi1(a)
{
document.location.replace('Scheda.aspx?libro='+a);
return false
}
</script>

<script language=vb runat=server>
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim rdr As OleDbDataReader

Dim ConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;"
& _
"Data Source=" & Server.MapPath("bookstore.mdb")

Msg1.Text = "BENVENUTO " & Session("utente") & " "
cn = New OleDbConnection(ConnString)

cn.Open()

Dim titolo As String
titolo = Request.QueryString("libro")


Dim sql As String = "SELECT titolo, AUTORE.cognome,
lettura_terminata, ultimo_letto FROM ((BOOK INNER JOIN LIBRIUTENTE ON
BOOK.ID=LIBRIUTENTE.libro) INNER JOIN AUTORE on BOOK.autore=AUTORE.ID)
INNER JOIN UTENTE on UTENTE.ID=LIBRIUTENTE.utente WHERE login='" &
Session("utente") & "';"


cmd = New OleDbCommand(sql, cn)

rdr = cmd.ExecuteReader()
Response.Write("</br>")
Response.Write("</br>")
'Response.Write("<html><body><form>")

Response.Write("<p>Gli ultimi libri che ha letto sono:</p>")
Response.Write("<table border=1 cellspacing=1>")
Response.Write("<tr><th>TITOLO</th><th>AUTORE</th><th>LETTURA
TERMINATA</th><th>ULTIMO PARAGRAFO LETTO</th></tr>")
If rdr.HasRows Then


While (rdr.Read())
Response.Write("<tr>")
Response.Write("<td>" & rdr.Item(0) & "</td>")
Response.Write("<td>" & rdr.Item(1) & "</td>")
Response.Write("<td>" & rdr.Item(2) & "</td>")
Response.Write("<td>" & rdr.Item(3) & "</td>")
Response.Write("<td><input type=button value=Leggi
onclick='return leggi1(" & rdr.Item(0) & ");'></td>")
Response.Write("</tr>")
End While

Response.Write("</table>")
'Response.Write("</form>")
'Response.Write("</body></html>")
Else
Msg2.Text = ("Non hai letto ancora nessun libro")
End If
rdr.Close()
cn.Close()
End Sub
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<P>
<asp:Label ID="Msg1" runat="server"
ForeColor="MidnightBlue" Style="z-index: 108; left: 16px;
position: absolute; top: 19px" Font-Bold="True"
Font-Size="Large" Height="24px" Width="424px"></asp:Label>
</P>
<p>Per effettuare la ricerca di un libro inserire i parametri
<br />
<br />
<asp:Label ID="Label1" runat="server" Text="Inserisci Titolo"
Width="160px" Font-Size="Large" Height="24px"></asp:Label>
<asp:TextBox ID="txttitolo" runat="server" Font-Size="Large"
Height="25px"></asp:TextBox>
<asp:Button ID="Button2" runat="server" Text="Cerca"
Font-Size="Large" Height="32px" Width="72px" />
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="Inserisci Autore"
Font-Size="Large" Height="24px" Width="160px"></asp:Label>
<asp:TextBox ID="txtautore" runat="server" Font-Size="Large"
Height="25px"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Cerca"
Font-Size="Large" Height="32px" Width="72px" />
<br />
<br />
<asp:Label ID="Msg2" runat="server" Font-Bold="False"
ForeColor="Red" Style="z-index: 108; left: 560px; position: absolute;
top: 320px" Font-Size="Large" Height="32px" Width="352px"></asp:Label>


</p>
</div>
</form>
</body>
</html>
 
Ad

Advertisements


Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top