Rieccomi!!
Premessa: Uso Visual Studio 2005 beta con framew.. 2.0
Quando creo un nuovo web automaticamente il VS mi crea Default.aspx e Default.aspx.vb ed una cartella App_Data vuota.
In Default.aspx
inserisco tutto l'hatm e l'asp con la form ecc..e in Default.aspx.vbcodice:<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <table> <tr> <td style="width: 45px"> </td> <td style="width: 62px"> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td> </tr> <tr> <td style="width: 45px"> </td> <td style="width: 62px"> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td> </tr> <tr> <td style="width: 45px"> <asp:Label ID="Label1" runat="server"></asp:Label></td> <td style="width: 62px"> <asp:Button ID="Button1" runat="server" Text="Button" /></td> </tr> </table> </div> </form> </body> </html>
inserisce tutto il codice vb.codice:Imports System.Data Imports System.Data.SqlClient Imports Microsoft.VisualBasic Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click If GetUser(TextBox1.Text, TextBox2.Text) Then Label1.Text = "ok" End If End Sub Public Function GetUser(ByVal login As String, ByVal password As String) As Boolean Dim myConnection As New SqlConnection("server='(local)';database=Clienti;user=sa") Dim CommandText As String = "select Login, Pass FROM Login where ([Login].[Login] = '" + login + "' and [Login].[Pass] = '" + password + "')" Dim myCommand As New SqlDataAdapter(CommandText, myConnection) Dim ds As New DataSet() myCommand.Fill(ds) Return True End Function End Class
Compilare Default.aspx.vb in una dll è possibile???
Io vorrei mettere il codice di Default.aspx.vb in una dll con la sequente stringa d comando: vbc /t:library Default.aspx.vb ma il compilatore mi da il segiente errore:
Handles Button1.click
e poi
errore BC30451:label is not declared
per la label e per i due textBox?!?!!?! Ripeto, il programma funziona benissimo ma nn mi crea la dll!!
Help!!!
Grazie

Rispondi quotando