Hi I want to Insert a data that is in Persian And English the string that I want to insert is '(پایه ۱۹۸=OID) -عبوری-متوسط'
but it shows ?????? instead of the data ... I want to insert the data by stored Procedure My stored Procedure is
USE [DAT1]
GO
/****** Object: StoredProcedure [dbo].[SP_insert] Script Date: 7/25/2018 3:32:46 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
SET ANSI_WARNINGS off;
GO
ALTER proc [dbo].[SP_insert]
@FirstName nvarchar(256) = null,
@LastName nvarchar(50),
@EmailAddress nvarchar (50),
@phone int
as
begin
insert into [tbl_test ] values (@FirstName,@LastName,@EmailAddress,@phone)
end
when I execute the procedure using N it works but the data comes from an app and I can't put N
in ADO.net I Want to Insert that data here is My code
protected void Button1_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("SP_insert", con);
cmd.CommandType = CommandType.StoredProcedure;
string mmmm = "(پایه 198=OID) -عبوری-متوسط";
cmd.Parameters.AddWithValue("@FirstName", mmmm);
cmd.Parameters.AddWithValue("@LastName", "ascascsacsa");
cmd.Parameters.AddWithValue("@EmailAddress", "advadsvasdv");
cmd.Parameters.AddWithValue("@phone", 1);
cmd.ExecuteNonQuery();
}
when I execute the Code It shows the Error
String or binary data would be truncated.
The statement has been terminated.
how can I solve this Thanks :)
Your database is just storing what it's receiving and it will store the desired characters just fine with your current setup if the tables are set to use N types (so check that too). Alter your application code to use a wider character set.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.