|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Query ProblemsIn my application i have a dataSet which has been created by the designer. I have added the following query to one of the tables; ------------------------------------------------------------------------------------------------------------------------------------------------ INSERT INTO reservationsTbl (OrderID, CustomerID, Time, PartySize, Date) VALUES (@OrderID, @CustomerID,@Time,@PartySize,@Date) ------------------------------------------------------------------------------------------------------------------------------------------------ I now have the following code to try and execute this query; ------------------------------------------------------------------------------------------------------------------------------------------------ Dim reservationsAdapter As New dsTableAdapters.reservationsTblTableAdapter Try reservationsAdapter.InsertReservation(10, ID, TimeTxt.Text, PartySizeTxt.Text, DatePicker.Value) Catch ex As Exception MsgBox("Inserting new record failed. " + ex.Message) End Try ------------------------------------------------------------------------------------------------------------------------------------------------ No error message is shown when the code is executed however the record is not inserted. Can anyone help? Thanks in advance! The word "Date" is an sql reserved word. The worrd "Time looks a bit
dodgy as well. Change the table name to something else or escape it by changing the sql query to this.... INSERT INTO reservationsTbl (OrderID, CustomerID, [Time], PartySize, [Date]) VALUES (@OrderID, @CustomerID,@Time,@PartySize,@Date) The Grand Master "When you have reached the top of the mountain you can look down at everyone else." Show quoteHide quote > > In my application i have a dataSet which has been created by the > designer. I have added the following query to one of the tables; > > ------------------------------------------------------------------------------------------------------------------------------------------------ > > INSERT INTO reservationsTbl > (OrderID, CustomerID, Time, PartySize, Date) > VALUES (@OrderID, @CustomerID,@Time,@PartySize,@Date) > > ------------------------------------------------------------------------------------------------------------------------------------------------ > > I now have the following code to try and execute this query; > > ------------------------------------------------------------------------------------------------------------------------------------------------ > > Dim reservationsAdapter As New > dsTableAdapters.reservationsTblTableAdapter > Try > reservationsAdapter.InsertReservation(10, ID, > TimeTxt.Text, PartySizeTxt.Text, DatePicker.Value) > Catch ex As Exception > MsgBox("Inserting new record failed. " + ex.Message) > End Try > > ------------------------------------------------------------------------------------------------------------------------------------------------ > > No error message is shown when the code is executed however the record > is not inserted. Can anyone help? > > Thanks in advance! |
|||||||||||||||||||||||