09/10/2018, 23:12
Cách đưa tiếng việt từ web vào CSDL?
Tôi có viết trang web cho nhập tiếng việt vào web. Sau đó dữ liệu này sẻ được lưu trong CSDL SQL, nhưng lưu vào CSDL thì không phải là tiếng việt nủa, nên khi đưa trở lại trang web không còn ra tiếng việt nưa. Ai biết giúp mình với, cám ơn!
Bài liên quan
xuanlamk1a@yahoo.com
public static void AddData(string data)
{
SqlConnection aCon = new SqlConnection(connectionString);
aCon.Open();
SqlCommand aCom = new SqlCommand("insert into Test values (@Data)", aCon);
aCom.Parameters.Add("@Data",SqlDbType.NVarChar,100 );
aCom.Parameters["@Data"].Value = data;
aCom.ExecuteNonQuery();
aCon.Close();
}
VD : insert into table value (N'textfield1', N'textfield2')
P/S : Theo tui thì nên dùng store procedure để insert vào DB
lưu unicode chi cho mệt