Results 1 to 9 of 9

Thread: Stored Procedure

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Posts
    688

    Stored Procedure

    Hi

    I have stored procedure for insert . I want if record is successfully inserted or not it should display message in form.

    Thanks

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Stored Procedure

    You would need to show us the code you are using for working with the SPROC from VB.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,836

    Re: Stored Procedure

    What DBMS you are using maybe helpful also
    Please remember next time...elections matter!

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Posts
    688

    Re: Stored Procedure

    Hi

    I am using Sql Server 2008

    Thanks

  5. #5
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,836

    Re: Stored Procedure

    Could you show us your code? There are a number of ways to call SPROCs. We need to see what you are doing. The answer depends on that.
    Please remember next time...elections matter!

  6. #6
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Stored Procedure

    @Jagjit - you've been a member her since 2011 and you have 324 posts. You are obviously not new to the forum!

    Did you not see my post - #2? Why did you ignore it?

    Now we are up to 5 posts - and you have Tyson asking for the same thing I asked for in post #2.

    If I show you code to do this - and it doesn't match the methods you already have in place, then I am wasting my time and I am wasting your time.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Posts
    688

    Re: Stored Procedure

    Dear szlamany

    O.k don't waste your time . i will send you the code

    Thanks

  8. #8
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Stored Procedure

    Well - that makes no sense - I guess I'll let others assist you. Have a good day!
    Last edited by szlamany; Mar 19th, 2014 at 06:33 AM.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  9. #9
    gibra
    Guest

    Re: Stored Procedure

    If you use a Command, as it should be, the Execute method returns the number of affected records:
    I.e. when insert a new record value of lngRecordsAffected = 1:

    Code:
        Dim lngRecordsAffected As Long
        With cmd
            .ActiveConnection = CN
            .CommandType = adCmdStoredProc
            .CommandText = sql_string
            ' add your parameters
            .Execute lngRecordsAffected
        End With
    Otherwise you may to use a Output parameter (but Access database doesn't support it)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width