Hi Jian Kang,
Thank you very much for your reply and
suggestion. Sql server and assembly file are on the same machine, after
the problem that i've posted i copied my XmlSerializers to another
location (like C:\dir\PCTrigger.XmlSerializers.dll) and then i could create assembly,no error like :
CREATE ASSEMBLY failed because it could not open the physical file ...
than i thought something wrong with the path,but it didn't look logical.
i'm going to tell what i want to do step by step and maybe it will be easier to find the error and the solution,here i go;
i created a trigger in visual studio for my project, code is :
using System;
using System.Data;
using System.Data.SqlClient;
using Microsoft.SqlServer.Server;
public partial class Triggers
{
// Enter existing table or view for the target and uncomment the attribute line
[Microsoft.SqlServer.Server.SqlTrigger (Name="AdayOyEklendi", Target="Aday", Event="FOR UPDATE")]
public static void AdayOyEklendi()
{
SqlTriggerContext sct = SqlContext.TriggerContext;
if (sct.IsUpdatedColumn(5))
{
String adayId;
SqlConnection conn = new SqlConnection("context connection=true");
conn.Open();
SqlCommand sqlCmd = conn.CreateCommand();
sqlCmd.CommandText = "SELECT * FROM " + "inserted";
SqlDataReader reader = sqlCmd.ExecuteReader();
reader.Read();
adayId = (String)reader[0];
reader.Close();
PCTrigger.PCAdayOy.PCAdayOyTopla adayOy = new PCTrigger.PCAdayOy.PCAdayOyTopla();
adayOy.PCAdayOyGonder(adayId);
conn.Close();
}
}
}
i couldn't check if that code is working or not yet because of this assembly problem.than i deployed this trigger in specified database (just right click and deploy) after that in trigger properties ( visual studio ) :
- generates serialization assembly -> on //for the web service
- Allow unsafe code
then in sql server query editor:
- TRUSTWORTHY ON
no problem till here,now i have to register my PCTrigger.XmlSerializers.dll which is under C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\HedeWebService\PCTrigger\bin\Debug but i couldn't succeed you know.
all i have got now is my trigger created in VS under assemblies.
i'm logged in as administrator ( windows server 2003 ) and i have the permission read&execute of the assembly file.
if you have any other suggestions i'm here,stuck with my problem.
thanks again.