Click here to Skip to main content
15,917,709 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: converting c# code into matlab Pin
Matt T Heffron9-Mar-15 13:24
professionalMatt T Heffron9-Mar-15 13:24 
QuestionConvert Borland c++ project to VC++ Pin
nextel1225-Mar-15 23:21
nextel1225-Mar-15 23:21 
SuggestionRe: Convert Borland c++ project to VC++ Pin
Richard MacCutchan5-Mar-15 23:58
mveRichard MacCutchan5-Mar-15 23:58 
AnswerRe: Convert Borland c++ project to VC++ Pin
Dave Kreskowiak6-Mar-15 9:16
mveDave Kreskowiak6-Mar-15 9:16 
QuestionC# Pin
Member 114944973-Mar-15 0:58
Member 114944973-Mar-15 0:58 
AnswerRe: C# Pin
Dave Kreskowiak3-Mar-15 6:47
mveDave Kreskowiak3-Mar-15 6:47 
AnswerRe: C# Pin
Richard Andrew x647-Mar-15 10:38
professionalRichard Andrew x647-Mar-15 10:38 
QuestionHow to integrate AUTOCAD dll files into .NET Framework? Pin
mmk1233-Mar-15 0:13
mmk1233-Mar-15 0:13 
AnswerRe: How to integrate AUTOCAD dll files into .NET Framework? Pin
manchanx3-Mar-15 0:31
professionalmanchanx3-Mar-15 0:31 
AnswerRe: How to integrate AUTOCAD dll files into .NET Framework? Pin
Dave Kreskowiak3-Mar-15 6:46
mveDave Kreskowiak3-Mar-15 6:46 
AnswerRe: How to integrate AUTOCAD dll files into .NET Framework? Pin
Eddy Vluggen3-Mar-15 7:14
professionalEddy Vluggen3-Mar-15 7:14 
QuestionGame in vb.net Pin
Minhaaj Edoo2-Mar-15 19:25
Minhaaj Edoo2-Mar-15 19:25 
AnswerRe: Game in vb.net Pin
Richard MacCutchan2-Mar-15 21:16
mveRichard MacCutchan2-Mar-15 21:16 
GeneralRe: Game in vb.net Pin
Minhaaj Edoo2-Mar-15 21:22
Minhaaj Edoo2-Mar-15 21:22 
GeneralRe: Game in vb.net Pin
Richard MacCutchan2-Mar-15 22:03
mveRichard MacCutchan2-Mar-15 22:03 
GeneralRe: Game in vb.net Pin
Minhaaj Edoo2-Mar-15 22:26
Minhaaj Edoo2-Mar-15 22:26 
GeneralRe: Game in vb.net Pin
Richard MacCutchan2-Mar-15 22:45
mveRichard MacCutchan2-Mar-15 22:45 
GeneralRe: Game in vb.net Pin
Dave Kreskowiak3-Mar-15 6:44
mveDave Kreskowiak3-Mar-15 6:44 
Questiontrigger Pin
Member 111616252-Mar-15 1:22
Member 111616252-Mar-15 1:22 
HI,

Every Body

This is My Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Sql;
using System.Data.SqlClient;
using Microsoft.SqlServer.Server;
using System.Data.SqlTypes;
using System.Text.RegularExpressions;



namespace trigger_test
{
public class trigger
{

public static void showinserted()
{
SqlTriggerContext triggContext = SqlContext.TriggerContext;
SqlConnection conn = new SqlConnection(" context connection =true ");
conn.Open();
SqlCommand sqlComm = conn.CreateCommand();
SqlPipe sqlP = SqlContext.Pipe;
SqlDataReader dr;
sqlComm.CommandText = "SELECT pub_id, pub_name from inserted";
dr = sqlComm.ExecuteReader();
while (dr.Read())
sqlP.Send((string)dr[0] + "," + (string)dr[1]);
}
}
}

========================================================
SQL SERVER

CREATE ASSEMBLY triggertest_2
FROM 'G:\Vijaya\trigger_test\trigger_test\bin\Debug\trigger_test.dll'
WITH PERMISSION_SET = SAFE

CREATE TRIGGER tri_Publishes_clrs
ON publishers_1
FOR INSERT
AS
EXTERNAL NAME triggertest_2.[trigger_test.trigger].showinserted


Create Table publishers_1
(
pub_id int,
pub_name nvarchar(50)
)

INSERT publishers_1
(pub_id, pub_name)
values (18,'Vijaya')

ERROR:- Msg 6522, Level 16, State 1, Procedure tri_Publishes_clrs, Line 1
A .NET Framework error occurred during execution of user-defined routine or aggregate "tri_Publishes_clrs":
System.InvalidCastException: Unable to cast object of type 'System.Int32' to type 'System.String'.
System.InvalidCastException:
at CLR_Triggers.trigger.showinserted()

How to Solve this Error????

Help

Thanks In Advance....
AnswerRe: trigger Pin
Richard MacCutchan2-Mar-15 1:27
mveRichard MacCutchan2-Mar-15 1:27 
QuestionRe Getting_Error Pin
Member 1116162527-Feb-15 17:20
Member 1116162527-Feb-15 17:20 
AnswerRe: Re Getting_Error Pin
Pete O'Hanlon27-Feb-15 21:51
mvePete O'Hanlon27-Feb-15 21:51 
QuestionGetting_Error Pin
Member 1116162526-Feb-15 19:26
Member 1116162526-Feb-15 19:26 
AnswerRe: Getting_Error Pin
Pete O'Hanlon26-Feb-15 20:18
mvePete O'Hanlon26-Feb-15 20:18 
QuestionError Pin
Member 1116162526-Feb-15 18:31
Member 1116162526-Feb-15 18:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.