Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SQL CLR UDT and File Access

4 views
Skip to first unread message

songstre

unread,
Feb 14, 2008, 12:26:06 PM2/14/08
to
I am currently trying to write a very simple UDT that checks for the
existence of a file. If the file does not exist it should return null.
It doesn't seem to see the file even when it exists, however. I've
checked and rechecked and the file is there. HELP!
I tried using both UNC and mapped drive.

[Microsoft.SqlServer.Server.SqlFunction(DataAccess =
DataAccessKind.Read, SystemDataAccess = SystemDataAccessKind.Read)]

[System.Security.Permissions.PrincipalPermission(System.Security.Permissions.SecurityAction.Demand)]
public static SqlString GetPictureUrl(string accountName)
{
try
{
if (accountName == null || accountName == string.Empty)
return SqlString.Null;
else if (System.IO.File.Exists(@"Y:\Hr\OurPeople\WhosWho
\photos\big\" + aname + ".jpg"))
return new SqlString("http://mh000xsiis01/hr/ourpeople/
whoswho/photos/big/" + aname + ".jpg");
else
return SqlString.Null;

}
catch (Exception exc)
{

throw exc;
}
}

0 new messages