Spanish Characters in SQL File

  • Thread starter Alhambra Eidos Kiquenet
  • Start date
A

Alhambra Eidos Kiquenet

Hi misters,



I have embedded file that contains SQL. I read the file and execute SQL, but
in my SQL SERVER it appears stranges characters:

wrong: Nueva Aplicaci?n

ok: Nueva Aplicación



In my Sql file, all caracters is ok, but when execute sql, in SQL Server is
wrongs



Any suggestions ?? Thanks in advance.



' Gets the current assembly.

Dim Asm As [Assembly] = [Assembly].GetExecutingAssembly()

' Resources are named using a fully qualified name.

Dim strm As Stream = Asm.GetManifestResourceStream( _

Asm.GetName().Name & "." & Name)

' Reads the contents of the embedded file.

Dim reader As StreamReader = New StreamReader(strm)

Dim sql As String = reader.ReadToEnd()

'MsgBox(Asm.GetName().Name & "." & Name & " Total: " & sql.Length)

Return sql
 
J

Jon Skeet [C# MVP]

I have embedded file that contains SQL.

What produced the file? Chances are it's not in UTF-8, which is the
default encoding if you don't specify one to StreamReader.

Change your StreamReader code to:

Dim reader As StreamReader = New StreamReader(strm, Encoding.Default)

to use the default system encoding (e.g. Windows CP 1252) - or a
different encoding if you know the right one. You should also make
sure that your StreamReader is closed using a Using statement.

Out of interest, why are you posting a question with VB code in the C#
group?

Jon
 
A

Alhambra Eidos Desarrollo

Thanks mister.
Not convert my code to C#, I think my question is about .NET, not particular
language. I don't mind C# or VB.NET for my issue.

Thanks.
 
J

Jon Skeet [C# MVP]

Alhambra Eidos Desarrollo
Thanks mister.
Not convert my code to C#, I think my question is about .NET, not particular
language. I don't mind C# or VB.NET for my issue.

In that case posting to microsoft.public.dotnet.framework or
microsoft.public.dotnet.general would have been more appropriate.

I just don't see why you chose to post in a C# group when you had VB
code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top