Quantcast
Channel: SQLServerCentral » Programming » SMO/RMO/DMO » Latest topics
Viewing all articles
Browse latest Browse all 99

Running .sql file using C# .Net - Accents Problem

$
0
0
Hello, I have this small app to run a batch of .sql files on multiple databases. When the .sql files have accents, (most of them comments) I get this error:[img]http://img5.imageshack.us/img5/7030/sinog.jpg[/img]The thing is that I can't remove the accents I must leave them there... So if anyone has any experience or advice to share it would be much appreciated.This is a example of the code im using:using System.Data.SqlClient;using System.IO;using Microsoft.SqlServer.Management.Common;using Microsoft.SqlServer.Management.Smo; namespace ConsoleApplication1{ class Program { static void Main(string[] args) { string sqlConnectionString = "Data Source=(local);Initial Catalog=AdventureWorks;Integrated Security=True"; FileInfo file = new FileInfo("C:\\myscript.sql"); string script = file.OpenText().ReadToEnd(); SqlConnection conn = new SqlConnection(sqlConnectionString); Server server = new Server(new ServerConnection(conn)); server.ConnectionContext.ExecuteNonQuery(script); } }

Viewing all articles
Browse latest Browse all 99

Latest Images

Trending Articles



Latest Images