[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.sqlserver.programming

Server.MapPath in SSIS script task? name "Server" is not declared.

jobs

3/21/2007 8:00:00 PM

I'm trying to read a file into a string.. this code has worked in
vb.net/asp.net.. but won't an ssis script task.

Imports system.io
...
Dim FILENAME as String = Server.MapPath("chat.txt")
Dim objStreamReader as StreamReader
objStreamReader = File.OpenText(FILENAME)
Dim contents as String = objStreamReader.ReadToEnd()
chat.text=contents
objStreamReader.Close()

I'm trying the same code in an ssis script task, and double checked
that I have system.io as a reference as well, but get compile error:

Name "Server" is not declared.

If I remove the mappath and try to open the string, I get :

The given path's format is not supported.

Thanks for any help or information!

1 Answer

RLoski

3/22/2007 1:17:00 AM

0

"Server" is a property of a web page in the System.Web.UI namespace. I
assume that you are putting the file in a specific place in relationship to
the SSIS package. I am still rather unfamiliar with SSIS, but I would assume
that there is some object that has a property that can give you that path
name. From that you can use System.IO.Path.Combine to combine that path name
with your file name.
--
Russel Loski, MCSD.Net