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

.NET (Core and Framework)

 
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 
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 
HI
Every Body,

This is my Class File Code:

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

namespace TrgMail
{
public class trgMail
{
[SqlTrigger(Name = @"EmailAudit", Target = "[dbo].[Users]", Event = "For Insert")]
public static void MailValid()
{
String userName;
String realName;
SqlCommand command;
SqlTriggerContext triggerContext = SqlContext.TriggerContext;
SqlPipe pipe = SqlContext.Pipe;
SqlDataReader reader;
switch (triggerContext.TriggerAction)
{
case TriggerAction.Insert:
using (SqlConnection connection = new SqlConnection(@"context connection=true"))
{
connection.Open();
command = new SqlCommand(@"Select *from Inserted;",connection);
reader = command.ExecuteReader();
reader.Read();
userName = (string)reader[0];
realName = (string)reader[1];
reader.Close();
if (IsValidEMailAddress(userName))
{
command = new SqlCommand(@"Insert[dbo].[UserNameAudit]Values('" + userName + @"','" + realName + @"');", connection);
pipe.Send(command.CommandText);
command.ExecuteNonQuery();
pipe.Send("You inserted:" + userName);
}
else
{
try
{
pipe.Send("Invalid EmailID");
Transaction trans = Transaction.Current;
trans.Rollback();
}
catch (SqlException ex)
{

}
}
}
break;
}
}
public static bool IsValidEMailAddress(string email)
{
return Regex.IsMatch(email,@"^([\w-]+\.)*?[\w-]+@[\w-]+\.([\w-]+\.)*?[\w]+$");
}

}
}


===========================================================================================

SQL SERVER 2008

sp_configure CLR_Enabled,1
Go


Reconfigure
Go


alter Database Vijaya set Trustworthy on


Create Assembly ValidateEmailAssemblies
From'G:\Vijaya\SqlServerProject2\SqlServerProject2\bin\Debug\SqlServerProject2.dll'
with Permission_set=Unsafe


Create Table Users2
(
UserName nvarchar(200) Not Null,
RealName nvarchar(200)Not Null
)


Create Table UserNameAudit2
(
UserName nvarchar(200)Not Null,
RealName nvarchar(200)Not Null
)

Create Trigger EmailAudit1
on Users2 for Insert
As External Name ValidateEmailAssemblies.trgMail.MailValid
GO

ERROR:- Msg 6505, Level 16, State 2, Procedure EmailAudit1, Line 1
Could not find Type 'trgMail' in assembly 'SqlServerProject2'.


Please Help???


How to solve this Problem???

Thanks In Advance...
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 
SuggestionRe: Error Pin
Richard MacCutchan26-Feb-15 21:25
mveRichard MacCutchan26-Feb-15 21:25 
QuestionAccessing Telerik DropDownColumn from EditedTemplate Pin
byka25-Feb-15 7:21
byka25-Feb-15 7:21 
QuestionThe model item passed into the dictionary is of type 'WebTime_Sheet.Models.RegisterViewModel', but this dictionary requires a model item of type 'WebTime_Sheet.Models.Users'. Pin
Kriss Legrand23-Feb-15 16:23
Kriss Legrand23-Feb-15 16:23 
AnswerRe: The model item passed into the dictionary is of type 'WebTime_Sheet.Models.RegisterViewModel', but this dictionary requires a model item of type 'WebTime_Sheet.Models.Users'. Pin
Dave Kreskowiak23-Feb-15 17:30
mveDave Kreskowiak23-Feb-15 17:30 
GeneralRe: The model item passed into the dictionary is of type 'WebTime_Sheet.Models.RegisterViewModel', but this dictionary requires a model item of type 'WebTime_Sheet.Models.Users'. Pin
Kriss Legrand23-Feb-15 21:22
Kriss Legrand23-Feb-15 21:22 
GeneralRe: The model item passed into the dictionary is of type 'WebTime_Sheet.Models.RegisterViewModel', but this dictionary requires a model item of type 'WebTime_Sheet.Models.Users'. Pin
Dave Kreskowiak24-Feb-15 2:34
mveDave Kreskowiak24-Feb-15 2:34 
QuestionService Broker Pin
Member 1116162520-Feb-15 17:18
Member 1116162520-Feb-15 17:18 
AnswerRe: Service Broker Pin
Dave Kreskowiak20-Feb-15 17:58
mveDave Kreskowiak20-Feb-15 17:58 
Questionnested datalist not updating on databinding Pin
ankita prabha18-Feb-15 23:38
ankita prabha18-Feb-15 23:38 
QuestionExtract certain Text FROM PDF into my vb.NET TextBoxes Pin
VIERcntHOLZ11-Feb-15 5:21
VIERcntHOLZ11-Feb-15 5:21 
AnswerRe: Extract certain Text FROM PDF into my vb.NET TextBoxes Pin
Richard MacCutchan11-Feb-15 5:37
mveRichard MacCutchan11-Feb-15 5:37 
GeneralRe: Extract certain Text FROM PDF into my vb.NET TextBoxes Pin
VIERcntHOLZ11-Feb-15 5:46
VIERcntHOLZ11-Feb-15 5:46 
GeneralRe: Extract certain Text FROM PDF into my vb.NET TextBoxes Pin
Richard MacCutchan11-Feb-15 6:48
mveRichard MacCutchan11-Feb-15 6:48 

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.