Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7097867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T10:59:19+00:00 2026-05-28T10:59:19+00:00

Am using CLR Trigger to pass the values to WCF,everything works fine but when

  • 0

Am using CLR Trigger to pass the values to WCF,everything works fine but when try to pass the constant value its not pass thru WCF even its not throwing any exception.

CLR Trigger

public partial class Triggers
{

    public static EndpointAddress endpoint = new EndpointAddress(new Uri("http://localhost:8000/services/myservice"));
    public static WSHttpBinding httpBinding = new WSHttpBinding();
    public static ServiceClient.ServiceReference1.ServiceContractClient myclient = new ServiceClient.ServiceReference1.ServiceContractClient(httpBinding, endpoint);
    public delegate void MyDelagate(String crudType);
    [SqlProcedure()]

    [Microsoft.SqlServer.Server.SqlTrigger(Name = "WCFTrigger",
       Target = "tbCR", Event = "FOR UPDATE, INSERT")]
    public static void Trigger1()
    {
        SqlCommand cmd;
        SqlTriggerContext myContext = SqlContext.TriggerContext;
        SqlPipe pipe = SqlContext.Pipe;
        SqlDataReader reader;

        if(myContext.TriggerAction== TriggerAction.Insert)
        {
            using (SqlConnection conn = new SqlConnection(@"context connection=true"))
            {
                conn.Open();
                cmd = new SqlCommand(@"SELECT * FROM tbCR", conn);
                reader = cmd.ExecuteReader();
                reader.Read();

                //get the insert value's here
                string Name;
                Name = reader[1].ToString();
                reader.Dispose();
                myclient.InsertOccured(Name);
                }
            }
        }

    }
}

Interface

namespace SampleService
{
    [ServiceContract]
    interface IServiceContract
    {
        [OperationContract]
        void UpdateOccured();
        [OperationContract]
        void InsertOccured(String Name);
    }
}

Contract

namespace SampleService
{
    class MyService : IServiceContract
    {
         public void InsertOccured(string Name)
        {
            Console.WriteLine("Insert Occured",Name);
        }

    }
}

every time i insert record ,WCF shows “Insert Occured” only but i was expecting “Insert Occured, Test”.

Can you please guide me what i suppose to do to get the constant value from SLQ Tirgger.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T10:59:19+00:00Added an answer on May 28, 2026 at 10:59 am

    In your service operation implementation is looks like you need to add the string parameter to your Console.WriteLine() string template. In other words:

    Console.WriteLine("Insert Occured, {0}",Name);
    

    You can find more about Console.WriteLine and composite formatting here:
    http://msdn.microsoft.com/en-us/library/828t9b9h.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been having trouble using a value converter with a data trigger. In some
We're deploying some new WCF calls in our SQL 2005 DB using the CLR.
I read an article about using CLR integration in sqlserver and was wondering what
Possible Duplicate: Casting vs using the ‘as’ keyword in the CLR Which method is
Using top it's easy to identify processes that are hogging memory and cpu, but
Everything in the code below works except for the binding on the ContextMenu. This
I wrote a clr trigger whenever a new file get inserted in to my
New to VS2008... I am using CLR Forms to create a GUI. I put
Trying to set up caching on our datasets - we're using clr stored procedures
I'm using Python 2.5. The DLL I imported is created using the CLR. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.