Hey,
Voor school dienen wij een project te maken (volledig drie lagig), maar er zijn enkele problemen:
Onderste laag: connectielaag (alle sql en connectiestring)
Middelste laag: vb file achter de aspx pagina
Bovenste laag: aspx pagina
Productie_toevoegen.aspx:
Het gaat over de asp button cmdOpslagen
Code van productie_toevoegen.aspx.vb:
Als ik dit zo laat runnen krijg ik de foutmelding dat Me.txtTitel, Me.txtRegie, Me.txtAuteur, Me.txtBeschrijving, Me.txtCast, Me.txtPrijs, Me.cmbSeizoensID niet kunnen geconverteerd worden naar string, integer, boolean, double, ...
Dus heb dan het volgende gedaan (productie_toevoegen.aspx.vb):
Nu krijg ik de foutmelding dat hij eerst 'public sub new' moet uitvoeren. De code van 'sub opslaan_productie' heb ik reeds bij de sub new gezet, maar nog werkt dit niet.
Iemand enig idee...
Voor school dienen wij een project te maken (volledig drie lagig), maar er zijn enkele problemen:
Onderste laag: connectielaag (alle sql en connectiestring)
Middelste laag: vb file achter de aspx pagina
Bovenste laag: aspx pagina
Productie_toevoegen.aspx:
Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="productie_toevoegen.aspx.vb" Inherits="productie_toevoegen" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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="height: 21px; width: 150px;">Titel:</td>
<td style="height: 21px; width: 350px;">
<asp:TextBox ID="txtTitel" runat="server" Width="350px" MaxLength="50"></asp:TextBox></td>
</tr>
<tr>
<td style="height: 21px; width: 150px;">Regie:</td>
<td style="height: 21px; width: 350px;">
<asp:TextBox ID="txtRegie" runat="server" Width="350px" MaxLength="50"></asp:TextBox></td>
</tr>
<tr>
<td style="height: 21px; width: 150px;">Scenarioschrijver:</td>
<td style="height: 21px; width: 350px;">
<asp:TextBox ID="txtAuteur" runat="server" Width="350px" MaxLength="75"></asp:TextBox></td>
</tr>
<tr>
<td style="height: 21px; width: 150px;">Beschrijving:</td>
<td style="height: 21px; width: 350px;">
<asp:TextBox ID="txtBeschrijving" runat="server" Width="350px" Rows="5" TextMode="MultiLine"></asp:TextBox></td>
</tr>
<tr>
<td style="height: 21px; width: 150px;">Cast:</td>
<td style="height: 21px; width: 350px;">
<asp:TextBox ID="txtCast" runat="server" Width="350px"></asp:TextBox></td>
</tr>
<tr>
<td style="height: 21px; width: 150px;">Prijs:</td>
<td style="height: 21px; width: 350px;">
<asp:TextBox ID="txtPrijs" runat="server" Width="350px"></asp:TextBox></td>
</tr>
<tr>
<td style="height: 21px; width: 150px;">Seizoen:</td>
<td style="height: 21px; width: 350px;">
<asp:DropDownList ID="cmbSeizoensID" runat="server" DataSourceID="AccessDataSource1"
DataTextField="Naam" DataValueField="SeizoenID" Width="350px">
</asp:DropDownList><asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Schoolbond.mdb"
SelectCommand="SELECT [SeizoenID], [Naam] FROM [tblSeizoenen]">
</asp:AccessDataSource>
</td>
</tr>
<tr>
<td></td>
<td style="width: 350px">
<asp:Button ID="cmdOpslagen" runat="server" Text="Opslaan productie" Width="350px" OnClick="opslaan_productie" /></td>
</tr>
</table>
</div>
</form>
</body>
</html>
Het gaat over de asp button cmdOpslagen
Code van productie_toevoegen.aspx.vb:
Code:
Imports System
Imports System.Data
Imports Schoolbond
Partial Class productie_toevoegen
Inherits System.Web.UI.Page
Sub opslaan_productie(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)
Dim data As Connectie
data.opslaan_productie(Me.txtTitel, Me.txtRegie, Me.txtAuteur, Me.txtBeschrijving, Me.txtCast, Me.txtPrijs, Me.cmbSeizoensID)
End Sub
End Class
Als ik dit zo laat runnen krijg ik de foutmelding dat Me.txtTitel, Me.txtRegie, Me.txtAuteur, Me.txtBeschrijving, Me.txtCast, Me.txtPrijs, Me.cmbSeizoensID niet kunnen geconverteerd worden naar string, integer, boolean, double, ...
Dus heb dan het volgende gedaan (productie_toevoegen.aspx.vb):
Code:
Imports System
Imports System.Data
Imports Schoolbond
Partial Class productie_toevoegen
Inherits System.Web.UI.Page
Private theTitel As String
Private theRegie As String
Private theAuteur As String
Private theBeschrijving As String
Private theCast As String
Private thePrijs As Double
Private theSeizoenID As Integer
Public Property Titel() As String
Get
Return Me.theTitel
End Get
Set(ByVal value As String)
Me.theTitel = value
End Set
End Property
Public Property Regie() As String
Get
Return Me.theRegie
End Get
Set(ByVal value As String)
Me.theRegie = value
End Set
End Property
Public Property Auteur() As String
Get
Return Me.theAuteur
End Get
Set(ByVal value As String)
Me.theAuteur = value
End Set
End Property
Public Property Beschrijving() As String
Get
Return Me.theBeschrijving
End Get
Set(ByVal value As String)
Me.theBeschrijving = value
End Set
End Property
Public Property Cast() As String
Get
Return Me.theCast
End Get
Set(ByVal value As String)
Me.theCast = value
End Set
End Property
Public Property Prijs() As Double
Get
Return Me.thePrijs
End Get
Set(ByVal value As Double)
Me.thePrijs = value
End Set
End Property
Public Property SeizoenID() As Integer
Get
Return Me.theSeizoenID
End Get
Set(ByVal value As Integer)
Me.theSeizoenID = value
End Set
End Property
Public Sub New(ByVal anID As Integer, ByVal aTitel As String, ByVal aRegie As String, ByVal anAuteur As String, ByVal aBeschrijving As String, ByVal aCast As String, ByVal aPrijs As Double, ByVal aSeizoensID As Integer)
'Me.theProductieID = anID
Me.theTitel = aTitel
Me.theRegie = aRegie
Me.theAuteur = anAuteur
Me.theBeschrijving = aBeschrijving
Me.theCast = aCast
Me.thePrijs = aPrijs
Me.theSeizoenID = aSeizoensID
End Sub
Sub opslaan_productie(ByVal sender As Object, ByVal e As System.EventArgs)
Dim data As Connectie
data.opslaan_productie(Me.theTitel, Me.theRegie, Me.theAuteur, Me.theBeschrijving, Me.theCast, Me.thePrijs, Me.theSeizoenID)
'data.opslaan_productie(Me.theTitel, Me.theRegie, Me.theAuteur, Me.theBeschrijving, Me.theCast, Me.thePrijs, Me.theSeizoenID)
End Sub
End Class
Nu krijg ik de foutmelding dat hij eerst 'public sub new' moet uitvoeren. De code van 'sub opslaan_productie' heb ik reeds bij de sub new gezet, maar nog werkt dit niet.
Iemand enig idee...