jbeattie629
04-13-2012, 03:09 PM
booking system that won't save booking entry on a webform to a database ? been having trouble for about a week now and been posting here getting help from alot of people and just cant seem to get anywhere with the system, its a simple thing that im finding very hard, send me your email or private mail me if you think you can help and i will send you the system.
below is the code which isnt working its been floating around asp.net for a few days now with no luck on how to fix it. it has no errors showing up at all but still wont do its job.:mad: I have until tonight to get it sorted for a university presentation.
===================================================
Imports System.Data.SqlClient
Partial Class Bookings
Inherits System.Web.UI.Page
Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim myconn As SqlConnection
Dim sqlstring As String = ""
Dim [ActivityName] As String = ddlActivityName.SelectedValue.ToString
Dim [DateofBooking] As String = "txtDateofBooking.Text"
Dim [TimeofBooking] As String = "txtTimeofBooking.Text"
myconn = New SqlConnection("Provider=SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True")
myconn.Open()
sqlstring = "INSERT INTO Bookings (Activity Name, Time of Booking, Date of Booking)Values('" + [ActivityName] + "', '" + [DateofBooking] + "', '" + [TimeofBooking] + "') " '
Dim command As New SqlCommand(sqlstring, myconn)
command.Connection.Open()
command.ExecuteNonQuery()
myconn.Close()
End Sub
End Class[/CODE]
below is the code which isnt working its been floating around asp.net for a few days now with no luck on how to fix it. it has no errors showing up at all but still wont do its job.:mad: I have until tonight to get it sorted for a university presentation.
===================================================
Imports System.Data.SqlClient
Partial Class Bookings
Inherits System.Web.UI.Page
Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim myconn As SqlConnection
Dim sqlstring As String = ""
Dim [ActivityName] As String = ddlActivityName.SelectedValue.ToString
Dim [DateofBooking] As String = "txtDateofBooking.Text"
Dim [TimeofBooking] As String = "txtTimeofBooking.Text"
myconn = New SqlConnection("Provider=SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True")
myconn.Open()
sqlstring = "INSERT INTO Bookings (Activity Name, Time of Booking, Date of Booking)Values('" + [ActivityName] + "', '" + [DateofBooking] + "', '" + [TimeofBooking] + "') " '
Dim command As New SqlCommand(sqlstring, myconn)
command.Connection.Open()
command.ExecuteNonQuery()
myconn.Close()
End Sub
End Class[/CODE]