나는 내가 DropDownClosed event.It가 얻을하도록되어 있고,NVARCHAR 값은
using (SqlConnection conn = new SqlConnection(ConString))
{
// DO REMEMBER TO OPEN THE CONNECTION!!!
conn.Open();
// Connection Established
SqlCommand command = new SqlCommand("SELECT * FROM monitoring", conn);
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
string item = reader[11].ToString();
comboBoxPretraga.Items.Add(item);
}
}
}
또한 내 콤보 상자를 채우는 방법을 가지고 라틴어에서, 데이터를 필터링하지 않습니다 콤보의 값이며, 동일한 행의 데이터로 텍스트 상자를 채울 수 있습니다.
using (SqlConnection conn = new SqlConnection(ConString))
{
conn.Open();
// Connection Established
SqlCommand command = new SqlCommand("SELECT * FROM monitoring monitoring where konzervator_ime_prezime='" + comboBoxPretraga.Text + "'", conn);
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
string tlo = reader[2].ToString();
textBox_TloI.Text = tlo;
}
}
}
내 앱을 시작할 때 올바른 값은 콤보 박스에 있습니다. 그러나 cyrilic에있는 값 (예 : фдгдфгд)을 선택하면 textBox_TloI에 아무런 데이터도 표시되지 않습니다. 하지만 latinic 값을 선택하면 잘 작동합니다. 문제는 콤보 상자 값입니다. 왜냐하면 콤보에서 라틴어를 선택하면 텍스트 상자에 cyrilic이 표시됩니다. 그냥 콤보 상자에서 필터링에 맞는 cyrilic 값을 얻는 것 같지 않습니다 .. 도와주세요, 누군가?
[매개 변수화 된 SQL을 : 그냥 좋다고]를 설정해야 할 수도 있습니다 (https://codeblog.jonskeet.uk/2014/08/ 08/the-bobbytables-culture /) – ASh
xx = N'some text ' – Steve
[SQL 주입 알림] (http://msdn.microsoft.com/en-us/library/ms161953%28v=sql. 105 % 29.aspx) - SQL 문을 함께 연결하지 말아야 ** ** SQL 주입을 피하기 위해 ** 매개 변수화 된 쿼리 **를 사용하십시오. –