title: Execute postgres script with npgsql
body: <p>I have a script (*.sql) which creates tables.
  I am using Visual studio 2010 with npgsql to access postgres database.</p>
  
  <p>Could I execute a script from codebehind?</p>
  
  <p>This is the code I have tried:</p>
  
  <pre><code>string sqlConnectionString = @"myconnection";
  
  FileInfo file = new FileInfo(@"myfile.sql");
  
  string script = file.OpenText().ReadToEnd();
  
  NpgsqlConnection conn = new NpgsqlConnection(sqlConnectionString);
  
  Server server = new Server(new ServerConnection(conn));
  
  server.ConnectionContext.ExecuteNonQuery(script);
  file.OpenText().Close();
  </code></pre>
  
  <p>But But Visual studio dont recognize <code>Server</code>.</p>