Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How can I Inserting to a table

How can I Inserting to a table

Scheduled Pinned Locked Moved Database
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mghiassi
    wrote on last edited by
    #1

    I use SQL Server 2005 and Visual Basic 2005. I write these Statement in SQL Server but it executes these with error and the record dose not inserted into table Project. CREATE PROCEDURE Insert_Project (@pNumber_M int, @pRow_Agreement int, @pRow_Machine int, @pRow_Language int) AS BEGIN SET NOCOUNT ON; BEGIN TRY DECLARE @Number_O int; SELECT @Number_O=Number-sum(Number_A) FROM Machine_View WHERE Row=@pRow_Machine GROUP BY Number SET @Number_O=@Number_O-@pNumber_M; INSERT INTO Project (Number_A,Number_D,Row_Agreement,Row_Machine,Row_Language) VALUES (@pNumber_M,@Number_O,@pRow_Agreement,@pRow_Machine,@pRow_Language) UPDATE Project SET Number_D=@Number_O WHERE Row_Machine=@pRow_Machine END TRY BEGIN CATCH SELECT ERROR_PROCEDURE() AS ErrorProcedure; END CATCH END GO Please help me. Thank you.

    C 1 Reply Last reply
    0
    • M mghiassi

      I use SQL Server 2005 and Visual Basic 2005. I write these Statement in SQL Server but it executes these with error and the record dose not inserted into table Project. CREATE PROCEDURE Insert_Project (@pNumber_M int, @pRow_Agreement int, @pRow_Machine int, @pRow_Language int) AS BEGIN SET NOCOUNT ON; BEGIN TRY DECLARE @Number_O int; SELECT @Number_O=Number-sum(Number_A) FROM Machine_View WHERE Row=@pRow_Machine GROUP BY Number SET @Number_O=@Number_O-@pNumber_M; INSERT INTO Project (Number_A,Number_D,Row_Agreement,Row_Machine,Row_Language) VALUES (@pNumber_M,@Number_O,@pRow_Agreement,@pRow_Machine,@pRow_Language) UPDATE Project SET Number_D=@Number_O WHERE Row_Machine=@pRow_Machine END TRY BEGIN CATCH SELECT ERROR_PROCEDURE() AS ErrorProcedure; END CATCH END GO Please help me. Thank you.

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      mghiassi wrote:

      it executes these with error

      What error?


      Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: Introduction to AJAX (2nd May), SQL Server, Mock Objects My website

      M 1 Reply Last reply
      0
      • C Colin Angus Mackay

        mghiassi wrote:

        it executes these with error

        What error?


        Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: Introduction to AJAX (2nd May), SQL Server, Mock Objects My website

        M Offline
        M Offline
        mghiassi
        wrote on last edited by
        #3

        Hi The statement below return another code and not zero SELECT ErrorProcedure AS ERRORPROCEDURE Thanks for your help

        C 1 Reply Last reply
        0
        • M mghiassi

          Hi The statement below return another code and not zero SELECT ErrorProcedure AS ERRORPROCEDURE Thanks for your help

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #4

          mghiassi wrote:

          The statement below return another code and not zero

          That is hardly helpful information. What code? If you remove the TRY/CATCH, what error is given (That should give you a textual description of the error)


          Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: Introduction to AJAX (2nd May), SQL Server, Mock Objects My website

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups