Query Problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jimmy

    #1

    Query Problems

    Hi

    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,@Ti me,@PartySize,@ Date)

    ------------------------------------------------------------------------------------------------------------------------------------------------

    I now have the following code to try and execute this query;

    ------------------------------------------------------------------------------------------------------------------------------------------------

    Dim reservationsAda pter As New
    dsTableAdapters .reservationsTb lTableAdapter
    Try
    reservationsAda pter.InsertRese rvation(10, ID,
    TimeTxt.Text, PartySizeTxt.Te xt, DatePicker.Valu e)
    Catch ex As Exception
    MsgBox("Inserti ng 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!

  • Master Programmer

    #2
    Re: Query Problems

    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,@Ti me,@PartySize,@ Date)


    The Grand Master
    "When you have reached the top of the mountain
    you can look down at everyone else."


    >
    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,@Ti me,@PartySize,@ Date)
    >
    ------------------------------------------------------------------------------------------------------------------------------------------------
    >
    I now have the following code to try and execute this query;
    >
    ------------------------------------------------------------------------------------------------------------------------------------------------
    >
    Dim reservationsAda pter As New
    dsTableAdapters .reservationsTb lTableAdapter
    Try
    reservationsAda pter.InsertRese rvation(10, ID,
    TimeTxt.Text, PartySizeTxt.Te xt, DatePicker.Valu e)
    Catch ex As Exception
    MsgBox("Inserti ng 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!

    Comment

    • Master Programmer

      #3
      Re: Query Problems

      "Thanks for your help" would have been nice. Ignorant shit !

      jimmy wrote:
      Hi
      >
      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,@Ti me,@PartySize,@ Date)
      >
      ------------------------------------------------------------------------------------------------------------------------------------------------
      >
      I now have the following code to try and execute this query;
      >
      ------------------------------------------------------------------------------------------------------------------------------------------------
      >
      Dim reservationsAda pter As New
      dsTableAdapters .reservationsTb lTableAdapter
      Try
      reservationsAda pter.InsertRese rvation(10, ID,
      TimeTxt.Text, PartySizeTxt.Te xt, DatePicker.Valu e)
      Catch ex As Exception
      MsgBox("Inserti ng 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!

      Comment

      • jimmy

        #4
        Re: Query Problems

        I'm sorry but i have only just checked the thread! Thanks anyway

        Comment

        • jimmy

          #5
          Re: Query Problems

          IT WORKS! Thanks for that... it would have taken me ages to figure out
          otherwise

          Comment

          • FishingScout

            #6
            Re: Query Problems

            He did thank you, you illiterate putz! Read his message.

            I am impressed that you actually help someone. (by the way, you don't
            need to thank me for that nice comment)

            Master Programmer wrote:
            "Thanks for your help" would have been nice. Ignorant shit !
            >
            jimmy wrote:
            Hi

            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,@Ti me,@PartySize,@ Date)

            ------------------------------------------------------------------------------------------------------------------------------------------------

            I now have the following code to try and execute this query;

            ------------------------------------------------------------------------------------------------------------------------------------------------

            Dim reservationsAda pter As New
            dsTableAdapters .reservationsTb lTableAdapter
            Try
            reservationsAda pter.InsertRese rvation(10, ID,
            TimeTxt.Text, PartySizeTxt.Te xt, DatePicker.Valu e)
            Catch ex As Exception
            MsgBox("Inserti ng 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!

            Comment

            • Master Programmer

              #7
              Re: Query Problems

              thanks

              The Grand Master

              FishingScout wrote:
              He did thank you, you illiterate putz! Read his message.
              >
              I am impressed that you actually help someone. (by the way, you don't
              need to thank me for that nice comment)
              >
              Master Programmer wrote:
              "Thanks for your help" would have been nice. Ignorant shit !

              jimmy wrote:
              Hi
              >
              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,@Ti me,@PartySize,@ Date)
              >
              ------------------------------------------------------------------------------------------------------------------------------------------------
              >
              I now have the following code to try and execute this query;
              >
              ------------------------------------------------------------------------------------------------------------------------------------------------
              >
              Dim reservationsAda pter As New
              dsTableAdapters .reservationsTb lTableAdapter
              Try
              reservationsAda pter.InsertRese rvation(10, ID,
              TimeTxt.Text, PartySizeTxt.Te xt, DatePicker.Valu e)
              Catch ex As Exception
              MsgBox("Inserti ng 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!

              Comment

              Working...