[Solution]FriendADD

Results 1 to 14 of 14
  1. #1
    C/C++ Programmer SirMaster is offline
    MemberRank
    Mar 2006 Join Date
    500Posts

    [Solution]FriendADD

    Credits: SirMaster.

    Solution:
    CREATE PROCEDURE [dbo].[spAddFriend]
    @nCID INT,
    @nFriendCID INT,
    @nFavorite INT
    AS
    BEGIN
    DECLARE @Ret INT
    SELECT @Ret = COUNT(*)
    FROM Friend
    WHERE CID = @nCID AND FriendCID = @nFriendCID

    DECLARE @nName NVARCHAR(4000)
    SELECT @nFriendCID = CID, @nName = Name
    FROM Character
    WHERE CID = @nFriendCID

    IF @Ret = 0
    INSERT INTO Friend
    VALUES(@nCID,@nFriendCID,@nFavorite,@nName)

    SELECT @Ret Ret

    END
    GO



    go to Friend table and in name column change 50 or 20 to 4000 and varchar to nvarchar
    Last edited by SirMaster; 08-01-07 at 10:46 AM.


  2. #2
    Account Upgraded | Title Enabled! Bryan1 is offline
    MemberRank
    Dec 2006 Join Date
    521Posts
    I can@t even add a friend as far as I know

  3. #3
    C/C++ Programmer SirMaster is offline
    MemberRank
    Mar 2006 Join Date
    500Posts
    i say help no solution.

  4. #4
    Account Upgraded | Title Enabled! vDrag0n is offline
    MemberRank
    Dec 2006 Join Date
    216Posts
    Post your column

  5. #5
    C/C++ Programmer SirMaster is offline
    MemberRank
    Mar 2006 Join Date
    500Posts
    now solved.
    solution in 1 Post
    Last edited by SirMaster; 03-01-07 at 02:52 PM.

  6. #6
    Account Upgraded | Title Enabled! Bryan1 is offline
    MemberRank
    Dec 2006 Join Date
    521Posts
    Ty SirMaster for the solution.

  7. #7
    Account Upgraded | Title Enabled! vDrag0n is offline
    MemberRank
    Dec 2006 Join Date
    216Posts
    Nice job, but for some reason mine was working already o.o

  8. #8
    C/C++ Programmer SirMaster is offline
    MemberRank
    Mar 2006 Join Date
    500Posts
    other problem for create solution ^^ spGetFriendList xD.

  9. #9
    MentaL's Slave Keith is offline
    LegendRank
    Nov 2004 Join Date
    2,671Posts
    Thanks mate.

  10. #10
    Enthusiast lestad983 is offline
    MemberRank
    Aug 2005 Join Date
    Lima - PerLocation
    28Posts
    is = for sql 2000???????????

  11. #11
    Member lwirkk is offline
    MemberRank
    Jan 2007 Join Date
    60Posts
    Quote Originally Posted by vDrag0n View Post
    Nice job, but for some reason mine was working already o.o
    ² ^^.

  12. #12
    Account Upgraded | Title Enabled! Centrix is offline
    MemberRank
    Jan 2007 Join Date
    NetherlandsLocation
    696Posts
    ours was working... or maybe the server-dev fixed it and he didnt tell me...

  13. #13
    Member k0ven is offline
    MemberRank
    Feb 2007 Join Date
    PortugalLocation
    69Posts

    Re: [Solution]FriendADD

    Noob Help for those who ALREADY HAVE a AddFriend procedure: Go to the database, GunzDB, expand Stored Procedures, right click in dbo.AddFriend and modify it. Erase all crap inside and copy paste THIS in it

    Code:
    USE [GunzDB]
    GO
    /****** Object:  StoredProcedure [dbo].[spAddFriend]    Script Date: 03/03/2007 04:02:00 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[spAddFriend]
    @nCID INT,
    @nFriendCID INT,
    @nFavorite INT
    AS
    BEGIN
    DECLARE @Ret INT
    SELECT @Ret = COUNT(*)
    FROM Friend
    WHERE CID = @nCID AND FriendCID = @nFriendCID
    
    DECLARE @nName NVARCHAR(4000)
    SELECT @nFriendCID = CID, @nName = Name
    FROM Character
    WHERE CID = @nFriendCID
    
    IF @Ret = 0
    INSERT INTO Friend
    VALUES(@nCID,@nFriendCID,@nFavorite,@nName)
    
    SELECT @Ret Ret
    
    END
    also search for the other SirMaster code to GetFriendList.

  14. #14
    Account Upgraded | Title Enabled! kochon is offline
    MemberRank
    Nov 2006 Join Date
    MontrealLocation
    1,451Posts

    Re: [Solution]FriendADD

    Quote Originally Posted by vDrag0n View Post
    Nice job, but for some reason mine was working already o.o
    me too



Advertisement