Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 20th, 2007, 08:31 AM
Registered User
 
Join Date: Dec 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default StoredProcedure For Adding PlayList

Hi...

Am working with asp.net with vb for a MusicProject..

In this I have playlist for particular User..ie User Selects Some Songs and clicks on AddToMyPlayList Button....

Here He can insert those songs into a new playlist or update the earlier..

the StroedProcedure is as follws: 'N' means NewPlayList and 'E' means Existing

 ************************************************** *************************************

CREATE PROCEDURE MUSIC_ADD_PLAYLIST
(
@PLAYLIST_NAME VARCHAR(255),
@USER_ID VARCHAR(255),
@ItemList NVARCHAR(4000),
@delimiter CHAR(1),
@FOLDERNAME VARCHAR(255) ,
@PLAYLISTTYPE CHAR(1)
)
AS

SET NOCOUNT ON

  DECLARE @IDENT INT


IF @PLAYLISTTYPE = 'N'

BEGIN

  INSERT INTO MUSIC_PLAYLIST
  (
   MUSIC_PLAYLIST_NAME,
   MUSIC_PLAYLIST_USER
  )

  VALUES

  (
   @PLAYLIST_NAME,
   @USER_ID
  )


  SELECT @IDENT=@@IDENTITY FROM MUSIC_PLAYLIST

END

 IF @PLAYLISTTYPE='E'

 BEGIN

 SELECT @IDENT=MUSIC_PLAYLIST_ID FROM MUSIC_PLAYLIST WHERE MUSIC_PLAYLIST_USER=@USER_ID AND MUSIC_PLAYLIST_NAME=@PLAYLIST_NAME

 END


  DECLARE @tempItemList NVARCHAR(4000)
      SET @tempItemList = @ItemList

      DECLARE @i INT
      DECLARE @Item NVARCHAR(4000)

      SET @tempItemList = REPLACE (@tempItemList, ' ', '')
      SET @i = CHARINDEX(@delimiter, @tempItemList)

      WHILE (LEN(@tempItemList) > 0)
      BEGIN
          IF @i = 0
              SET @Item = @tempItemList
          ELSE
              SET @Item = LEFT(@tempItemList, @i - 1)
         -- INSERT INTO @IDTable(Item) VALUES(@Item)



   INSERT INTO MUSIC_SONGSLIST
    (Music_PlayList_Id,Music_SongName,Music_Song_Locat ion)
    VALUES
    (@IDENT,@ITEM,@FOLDERNAME+'\'+@ITEM)


          IF @i = 0
              SET @tempItemList = ''
          ELSE
              SET @tempItemList = RIGHT(@tempItemList, LEN(@tempItemList) - @i)
          SET @i = CHARINDEX(@delimiter, @tempItemList)

  END

GO

************************************************** *************************************

Here the problem is am not getting the exact result means if i add 6 songs to a playlist it is adding only 4 songs to that particular playlist..

Please help me out

Thanks in Advance,

Madhavi








Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with StoredProcedure tmadhavi SQL Server 2000 1 December 26th, 2007 12:41 PM
Add Items in .WAX PlayList Using javascript window ajohri Javascript 6 November 22nd, 2007 03:59 AM
Using AJax Update Panel With Project Playlist jazzcatone ASP.NET 2.0 Professional 1 July 22nd, 2007 12:35 PM
how to create playlist for real audio files method PHP How-To 0 July 11th, 2005 08:11 AM
StoredProcedure NiNe ADO.NET 1 March 1st, 2004 07:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.