View Full Version : anybody able to look at my system ? booking system

04-13-2012, 04: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")

sqlstring = "INSERT INTO Bookings (Activity Name, Time of Booking, Date of Booking)Values('" + [ActivityName] + "', '" + [DateofBooking] + "', '" + [TimeofBooking] + "') " '

Dim command As New SqlCommand(sqlstring, myconn)

End Sub

End Class[/CODE]

04-13-2012, 07:03 PM
I just need someone to look at it, no errors and its a very small website and everything is straightforward , it will take a professional or someone who is used to asp.net a couple of minutes to sort this :cool: , please could someone have a look everything looks fine just the code is doing nothing. I have a deadline for this website for tomorrow and it just needs this small push to get it finished. thanks to anybody who takes an interest in my post. :D

04-13-2012, 07:35 PM
first thing you need to do is set a break point and make sure your three strings actually have a value

Also I did this (I didn't know if you're brackets would cause an issue)

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

Dim query As String = String.Format("insert into tbl_People values ('{0}','{1}','{2}','{3}','{4}')", TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, TextBox5.Text)
Dim [parm1] As String = "_A_demo"
Dim [parm2] As String = "_A_demoL"
Dim [parm3] As String = "123654987"
Dim parm4 As String = "132 fake"
Dim parm5 As String = "11111"
Dim _Query As String = "insert into tbl_People values ('" + [parm1] + "','" + [parm2] + "','" + [parm3] + "','" + parm4 + "','" + parm5 + "')"

Dim conn As New SqlConnection(cnstr)
Using conn
Dim cmd As New SqlCommand(_Query, conn)
cmd.CommandType = CommandType.Text
Using cmd
End Using
End Using
TextBox1.Text = TextBox2.Text = TextBox3.Text = TextBox4.Text = TextBox5.Text = ""
End Sub

now I tried various combinations of &, +, []'s on all, []'s on some, as well as dynamic pulling from a text box...
I also tried this

Using cmd
'Dim dr As SqlDataReader = cmd.ExecuteReader
'Dim tmptbl As New DataTable
'TextBox1.Text = tmptbl.Rows.Count
End Using

with the code uncommented and removing the cmd.executenonquery with a select statement- to verify my connection was sound. I would try that as well.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum