S
songstre
am currently trying to write a very simple UDF 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.Permission
s.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;
}
}
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.Permission
s.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;
}
}