locked
Can somebody help me convert this to visual basic code? RRS feed

  • Question

  • set ANSI_NULLS ON
    set QUOTED_IDENTIFIER ON
    go

    ALTER PROCEDURE [dbo].[usp_InsertSeries]
    (
    @qty int
    )
    AS
    BEGIN
    DECLARE @Ctr Int, @SeriesVal Bigint
    SET @Ctr = 1
    SET @SeriesVal = (SELECT SeriesVal FROM dbo.tbl_SeriesCode WHERE SeriesCode = 1)

    WHILE @Ctr <= @qty
    BEGIN
    INSERT INTO dbo.tbl_Series
    (BS, ES)
    VALUES(@SeriesVal + @Ctr, @SeriesVal + @Ctr)
    SET @Ctr = @Ctr + 1
    END

    UPDATE dbo.tbl_SeriesCode
    SET SeriesVal = @SeriesVal + @Qty
    WHERE SeriesCode = 1


    END

    thanks! 

    • Moved by Cindy Meister MVP Wednesday, January 30, 2013 5:01 PM not VSTO or Office related
    Wednesday, January 30, 2013 4:47 PM

Answers

All replies

  • Hello guys.. I'm new in programming.. I really need your help.. thanks in advance

    Im having a hard time working on my program in visual studio windows application with local DB... i want to enter a quantity in a textbox then when i press save button... the qty i typed in textbox will create same rows also in my data...... for example my first digit is 1.... then when i enter 10 in textbox.. it will create 10 rows with number 2 , 3 ,4 , 5, 6 ,7 ,8 ,9 ,10 ,11.

    Wednesday, January 30, 2013 4:54 PM
  • You should ask in the Visual Basic forum.

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer



    My Blog: http://unlockpowershell.wordpress.com
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})

    Wednesday, January 30, 2013 11:12 PM
  • thanks Karl! Sorry I'm new in this forum. Thanks again :)
    Wednesday, January 30, 2013 11:38 PM
  • You are welcome :)

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer



    My Blog: http://unlockpowershell.wordpress.com
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})

    Thursday, January 31, 2013 1:26 AM
  • Or possibly over here.

    http://social.msdn.microsoft.com/Forums/en/transactsql/threads

     

     

     


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

    • Proposed as answer by Just Karl Thursday, January 31, 2013 1:47 PM
    Thursday, January 31, 2013 3:18 AM