System.IO.FileInfo.OpenText C# (CSharp) Method

OpenText() public method

public OpenText ( ) : System.IO.StreamReader
return System.IO.StreamReader
        public System.IO.StreamReader OpenText() { throw null; }
        public System.IO.FileStream OpenWrite() { throw null; }

Same methods

FileInfo::OpenText ( ) : StreamReader

Usage Example

Example #1
0
        public void execute(string file_path)
        {
            // read script
            var file = new FileInfo(file_path);
            string script = file.OpenText().ReadToEnd();

            // execute script
            var connection = new SqlConnection(connection_string);
            var server = new Server(new ServerConnection(connection));
            server.ConnectionContext.ExecuteNonQuery(script);
            System.Diagnostics.Debug.WriteLine("Server Instance Name: " + server.InstanceName);
            file.OpenText().Close();
        }
All Usage Examples Of System.IO.FileInfo::OpenText