A
anony
Hello,
I can't figure out why my parameterized query from an ASP.NET page is
dropping "special" characters such as accented quotes & apostrophes, the
registered trademark symbol, etc. These symbols insert without problem from
query analyzer, so that suggests it's something within ASP.NET. I've tried
using .NET textbox web controls as well as html textareas. I have a test
database set up with 4 fields: varchar, nvarchar, text, and ntext - they
all do the same thing. Regular text inserts fine, but it will simply remove
the special characters. I've searched usenet and the web for info, but to
no avail. Someone must have expereinced this issue! I'm running v1.1 with
the latest SP. Thanks for any help! Here's my code, doing my parameters in
different ways:
------------
Dim conCS As SqlConnection
Dim cmdSqlCommand As SqlCommand
Dim strSQL As String
Dim myParam As New SqlParameter
conCS = New SqlConnection(
ConfigurationSettings.AppSettings("ConnectionString") )
conCS.Open()
strSQL = " INSERT INTO TEST VALUES (@TEST_VARCHAR, @TEST_NVARCHAR,
@TEST_TEXT, @TEST_NTEXT) "
cmdSqlCommand = New SqlCommand( strSQL, conCS )
myParam.ParameterName = "@TEST_NVARCHAR"
myParam.SqlDbType = SqlDbType.NVarchar
myParam.Value = txtTest.Text
cmdSqlCommand.Parameters.Add(myParam)
cmdSqlCommand.Parameters.Add( "@TEST_VARCHAR", txtTest.Text )
cmdSqlCommand.Parameters.Add( "@TEST_TEXT", txtTest.Text )
cmdSqlCommand.Parameters.Add( "@TEST_NTEXT", txtTest.Text )
cmdSqlCommand.ExecuteNonQuery()
conCS.Close()
-------------
I can't figure out why my parameterized query from an ASP.NET page is
dropping "special" characters such as accented quotes & apostrophes, the
registered trademark symbol, etc. These symbols insert without problem from
query analyzer, so that suggests it's something within ASP.NET. I've tried
using .NET textbox web controls as well as html textareas. I have a test
database set up with 4 fields: varchar, nvarchar, text, and ntext - they
all do the same thing. Regular text inserts fine, but it will simply remove
the special characters. I've searched usenet and the web for info, but to
no avail. Someone must have expereinced this issue! I'm running v1.1 with
the latest SP. Thanks for any help! Here's my code, doing my parameters in
different ways:
------------
Dim conCS As SqlConnection
Dim cmdSqlCommand As SqlCommand
Dim strSQL As String
Dim myParam As New SqlParameter
conCS = New SqlConnection(
ConfigurationSettings.AppSettings("ConnectionString") )
conCS.Open()
strSQL = " INSERT INTO TEST VALUES (@TEST_VARCHAR, @TEST_NVARCHAR,
@TEST_TEXT, @TEST_NTEXT) "
cmdSqlCommand = New SqlCommand( strSQL, conCS )
myParam.ParameterName = "@TEST_NVARCHAR"
myParam.SqlDbType = SqlDbType.NVarchar
myParam.Value = txtTest.Text
cmdSqlCommand.Parameters.Add(myParam)
cmdSqlCommand.Parameters.Add( "@TEST_VARCHAR", txtTest.Text )
cmdSqlCommand.Parameters.Add( "@TEST_TEXT", txtTest.Text )
cmdSqlCommand.Parameters.Add( "@TEST_NTEXT", txtTest.Text )
cmdSqlCommand.ExecuteNonQuery()
conCS.Close()
-------------