when i insert a text into a table in sql server, rows didn’t show text and show ??????
i know with blow code can correct it:
INSERT [dbo].[TableName] (CityName,latitude,longitude)
VALUES (N'txt',34,56)
but i use this code for insert :
INSERT INTO [dbo].[TableName]
VALUES (@CityName,@latitude,@longitude)
sqlcmd.Parameters.Add("@CityName",SqlDbType.VarChar);
sqlcmd.Parameters.Add("@latitude", SqlDbType.Int);
sqlcmd.Parameters.Add("@longitude", SqlDbType.Int);
what can i do ?
thanks
Try using
SqlDbType.NVarCharas type for your@CityNameinstead of the varchar you currently use.Also, like Prasanna suggests, use
which would probably work without needing to specify the type, in your case.