Re: Losing characters with sql parameterized insert query
From: Girish Bharadwaj (girishb_at_mvps.org)
Date: 09/13/04
- Next message: Scott Allen: "Re: load balancer: problem with session"
- Previous message: clintonG: "Re: Need ASP.NET Link Click Counter"
- In reply to: anony: "Losing characters with sql parameterized insert query"
- Next in thread: Greg Burns: "Re: Losing characters with sql parameterized insert query"
- Reply: Greg Burns: "Re: Losing characters with sql parameterized insert query"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 13 Sep 2004 11:55:17 -0400
A dump question, are you sure that txtTest.Text contains all those special
chars?
-- Girish Bharadwaj http://msmvps.com/gbvb "anony" <nosp@m.com> wrote in message news:bMh1d.43696$w_4.6339662@twister.tampabay.rr.com... > 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() > > ------------- > >
- Next message: Scott Allen: "Re: load balancer: problem with session"
- Previous message: clintonG: "Re: Need ASP.NET Link Click Counter"
- In reply to: anony: "Losing characters with sql parameterized insert query"
- Next in thread: Greg Burns: "Re: Losing characters with sql parameterized insert query"
- Reply: Greg Burns: "Re: Losing characters with sql parameterized insert query"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|