我正在创建一个应用程序,人们可以在其中插入包含事件名称,位置,日期,小时等信息的事件。
有3个步骤。成功插入插入的前两个步骤。但是在第3步,他们必须插入一个startDay(Startdag),endDay(Einddag),starthour(startUurt),endHour(eindUur)我无法修复它。
在表示层中,我使用calendarExtender作为开始日和结束日,格式为d MMMM yyyy with和target txt_sDag和txt_eDag
在数据集“DAL_Planit3.xsd”中,我将endDay和startDay作为类型“datetime”,将startHour和endHour作为String类型(becoz我们只会读取它,我们不会对它做任何事情)。
有人可以帮帮我吗?
StepThree.aspx.vb
Protected Sub btn_next_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_next.Click
Try
Dim BLLdata As New BLL_Data
Dim eventID As Integer = Session.Item("eventID")
Dim plaatsID As Integer = Session.Item("plaatsID")
Dim data As New CL_Data
data.Einddag = txt_eDag.Text
data.Startdag = CDate(txt_sDag.Text)
data.Einddag = CDate(txt_eDag.Text)
data.Einduur = txt_eUur.Text
data.StartUur = txt_sUur.Text
data.FKEvenementId = eventID
data.FKPlaatsId = plaatsID
BLLdata.insertData(data)
lbl_feedback.Text = "Data succesful inserted!"
Catch ex As Exception
lbl_feedback.Text = "Data not inserted! " + ex.Message
End Try
End Sub
End Class
*的 BLL_Data.vb *
' INSERT DATA
Public Function insertData(ByVal data As CL_Data) As String
Dim feedback As String = Nothing
Try
adapterDatum3.Insert(data.Startdag, data.Einddag, data.StartUur, data.Einduur, data.FKPlaatsId, data.FKEvenementId)
'adapterDatum.Insert(data.Startdag, data.Einddag, data.StartUur, data.Einduur, data.FKPlaatsId, data.FKEvenementId)
feedback = "Data is toegevoegd"
Catch ex As Exception
feedback = ex.Message
End Try
Return feedback
End Function
CL_Data
Public Class CL_Data
Private iDataId As Integer
Public Property DataID() As Integer
Get
Return iDataId
End Get
Set(ByVal value As Integer)
iDataId = value
End Set
End Property
Private dStartDag As Date
Public Property Startdag() As Date
Get
Return dStartDag
End Get
Set(ByVal value As Date)
dStartDag = value
End Set
End Property
Private dEindDag As Date
Public Property Einddag() As Date
Get
Return dEindDag
End Get
Set(ByVal value As Date)
dEindDag = value
End Set
End Property
Private tStartUur As String
Public Property StartUur() As String
Get
Return tStartUur
End Get
Set(ByVal value As String)
tStartUur = value
End Set
End Property
Private tEindUur As String
Public Property Einduur() As String
Get
Return tEindUur
End Get
Set(ByVal value As String)
tEindUur = value
End Set
End Property
Private iFKPlaatsId As Integer
Public Property FKPlaatsId() As Integer
Get
Return iFKPlaatsId
End Get
Set(ByVal value As Integer)
iFKPlaatsId = value
End Set
End Property
Private iFKEvenementId As Integer
Public Property FKEvenementId() As Integer
Get
Return iFKEvenementId
End Get
Set(ByVal value As Integer)
iFKEvenementId = value
End Set
End Property
End Class