what am i doing wrong ? this code needs to be working by the weekend for a project and it has worked for others? can anybody see why its not working for me, also anything within this coding that needs to be looked at else where, e.g web.config etc currently
the frist 3 strings are not working:
and sqlcon and strcommand and also the if then and end if of the follwing codes crops up with a blue underline
If sqlcon.State = Data.ConnectionState.Open Then
sqlcon.Close()
End If
-------------------------------
Partial Class bookings
Inherits System.Web.UI.Page
Dim strActivityName, strDateofBooking, strTimeofBooking As String
strActivityName = ddlActivityName.Text
strDateofBooking = txtDateofBooking.Text
strTimeofBooking = txtTimeofBooking.Text
Dim sqlcon As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
If sqlcon.State = Data.ConnectionState.Open Then
sqlcon.Close()
End If
sqlcon.Open()
Dim strcommand As String
strcommand = "Insert into Bookings([Activity Name],[Date of Booking],[Time of Booking]
Values('" + strActivityName + "', '" + strDateofBooking + "', '" + strTimeofBooking + "') "
Dim sqlcomm As New SqlCommand(strcommand, sqlcon)
Dim o As String = sqlcomm.ExecuteNonQuery()
Label2.Text = "Booking complete!" + " your booking is complete." + "your Activity is " + ddlActivityname.SelectedItem.ToString + " Activity"
End Class
Description: An
error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Line 4: Inherits System.Web.UI.Page
Line 5: Dim strActivityName, strDateofBooking, strTimeofBooking As String
Line 6: strActivityName = ddlActivityName.Text
jbeattie629
0 Points
26 Posts
booking system coding not working HELP!!!
Apr 11, 2012 05:14 PM|LINK
what am i doing wrong ? this code needs to be working by the weekend for a project and it has worked for others? can anybody see why its not working for me, also anything within this coding that needs to be looked at else where, e.g web.config etc currently the frist 3 strings are not working:
strActivityName = ddlActivityName.Text
strDateofBooking = txtDateofBooking.Text
strTimeofBooking = txtTimeofBooking.Text
and sqlcon and strcommand and also the if then and end if of the follwing codes crops up with a blue underline
If sqlcon.State = Data.ConnectionState.Open Then
sqlcon.Close()
End If
-------------------------------
Partial Class bookings
Inherits System.Web.UI.Page
Dim strActivityName, strDateofBooking, strTimeofBooking As String
strActivityName = ddlActivityName.Text
strDateofBooking = txtDateofBooking.Text
strTimeofBooking = txtTimeofBooking.Text
Dim sqlcon As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
If sqlcon.State = Data.ConnectionState.Open Then
sqlcon.Close()
End If
sqlcon.Open()
Dim strcommand As String
strcommand = "Insert into Bookings([Activity Name],[Date of Booking],[Time of Booking]
Values('" + strActivityName + "', '" + strDateofBooking + "', '" + strTimeofBooking + "') "
Dim sqlcomm As New SqlCommand(strcommand, sqlcon)
Dim o As String = sqlcomm.ExecuteNonQuery()
Label2.Text = "Booking complete!" + " your booking is complete." + "your Activity is " + ddlActivityname.SelectedItem.ToString + " Activity"
End Class
vijayst
All-Star
16558 Points
3216 Posts
Microsoft
Re: booking system coding not working HELP!!!
Apr 11, 2012 05:26 PM|LINK
What is the data type of [Date of Booking], [Time of Booking]? When you say, it is not working, what / where is the exception being thrown?
http://liteblog.codeplex.com
jbeattie629
0 Points
26 Posts
Re: booking system coding not working HELP!!!
Apr 11, 2012 05:33 PM|LINK
date of booking - date
time of booking - time(7)
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30188: Declaration expected.
Source Error:
Line 4: Inherits System.Web.UI.Page Line 5: Dim strActivityName, strDateofBooking, strTimeofBooking As String Line 6: strActivityName = ddlActivityName.TextMark-yu
Participant
888 Points
127 Posts
Re: booking system coding not working HELP!!!
Apr 13, 2012 09:16 AM|LINK
Hi,
Maybe the problem is here
You use a dropdownlist, so the ddlActivityName.Text does not equal with ddlActivityName.SelectedItem.ToString(). I tried you project
But i don't get the same error
hope it helps, if there still any error , reply me please.