Skip to content

Instantly share code, notes, and snippets.

@jsakamoto
Created June 28, 2012 06:24
Show Gist options
  • Save jsakamoto/3009493 to your computer and use it in GitHub Desktop.
Save jsakamoto/3009493 to your computer and use it in GitHub Desktop.
re-connect UDL to local server by F#
open System;;
open System.IO;;
open System.Text;;
open System.Text.RegularExpressions;;
let dir = @"c:\workdir";;
Directory.GetFiles(dir, "*.udl")
|> Seq.map (fun x-> (x, File.ReadAllText(x)))
|> Seq.map (fun(x,y)->(x, Regex.Replace(y,"Data Source=[^;]+",@"Data Source=.\SQLEXPRESS")))
|> Seq.iter (fun (x,y) -> File.WriteAllText(x,y,Encoding.Unicode));;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment