Results 1 to 11 of 11
  1. #1
    Join Date
    Oct 2003
    Posts
    5

    Unanswered: May (or CAN) I use triggers ?

    I need to call a procedure/function in VB when my DB is modified
    with insert, update or delete. I know that its possible to do
    something called Trigger, put how can my Triggers (in SQL Server or
    MSDE) call a procedure in VB ?

    Just to understand, this database catch information of users
    connected to a support chat and I need to know when this user get
    logged in (thru the rows of my table). When I notice that a new user
    have logged in, I need to support him.

    Thanks.

  2. #2
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621
    You can try to create extended stored procedure but I think it is not a good idea to use something like this in triggers (performance). Trigger could save info about new users in special table and VB could monitor this table.

  3. #3
    Join Date
    Oct 2003
    Posts
    5
    but if I do a procedure for VB to monitor a table, isn't it also bad for the permormance ?

  4. #4
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621
    Originally posted by ralf_davi
    but if I do a procedure for VB to monitor a table, isn't it also bad for the permormance ?
    Select from table is much faster (index, etc.) than running something no-native from trigger.

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    What interface are your users loggin in through? Can't that interface also alert you when the login occurs? I wonder if you aren't trying to put functionality in the wrong place.

    blindman

  6. #6
    Join Date
    Oct 2003
    Posts
    5
    Originally posted by blindman
    What interface are your users loggin in through? Can't that interface also alert you when the login occurs? I wonder if you aren't trying to put functionality in the wrong place.

    blindman
    Users are logging in thru ASP pages.
    I think that using ASP is not possible to alert me or anyone else. So I try do do a VB interface.
    Have another idea of what can I use ?

  7. #7
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    All contact with your database should be done through stored procedures, and you could place code in the procedure to notify your VB application.

    blindman

  8. #8
    Join Date
    Oct 2003
    Posts
    5
    Originally posted by blindman
    All contact with your database should be done through stored procedures, and you could place code in the procedure to notify your VB application.

    blindman
    How can I work with stored procedures to notify my VB application ?
    Can you give me a sign ?

  9. #9
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Hmmm....I'm not a VB expert, and a lot probably depends upon the particulars of your application, but some of the methods SQL Server can use to communicate with other applications are:

    1) Writing files.
    2) Calling xp_cmdshell to issue operating system commands.
    3) Calling xp_logevent to write to the NT Event Log.
    4) Creating your own extended stored procedure.
    5) xp_Sendmail

    blindman

  10. #10
    Join Date
    Sep 2003
    Posts
    522
    if you're carrying a pager you'd probably be better off calling an sp from the ASP page that can page you with an info pertinent to the newly logged on user. there are 2 (that I know of) methods that do not involve SQLMail, - xp_smtp_sendmail and cdo-based sendmail. i don't remember the web-sites, but google will find them.

  11. #11
    Join Date
    Oct 2003
    Posts
    1
    Originally posted by ralf_davi
    Users are logging in thru ASP pages.
    I think that using ASP is not possible to alert me or anyone else. So I try do do a VB interface.
    Have another idea of what can I use ?
    There are so many ways to alert you through ASP page. You can call your vb dll, send an email directly to you, etc. I would not suggest you to use trigger in this case.

Posting Permissions

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