Click here to Skip to main content
15,905,504 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
MySqlConnection conn = new MySqlConnection(baglan.connStr);
conn.Open();
sqlll = "select * from `mbs`.`kimlik` where id= '" + idd + "' and name='" + Adii + "' and surname='" + soyadii + "' and father_name='" + babaadii + "' and birth_day=" + dogum_tarih + "";
MySqlCommand cmd = new MySqlCommand(sqlll, conn);
MySqlDataReader rdr = cmd.ExecuteReader();
while(rdr.Read())
{
xxxxx
}

everything is ok.sqlll query is work there is no problem sqlll

but program not get in while (rdr.read()){}
it is going to rdr.close
cmd.close line

ı dont understand
Posted
Comments
E.F. Nijboer 12-Feb-12 13:37pm    
Do you get any results if you take the value of sqlll and execute it directly in MySQL Workbench (or whatever you use)?
Member-2338430 12-Feb-12 13:52pm    
ok ı found error but still ı dont understand mysql column type utf8 turkish ci
surname capital father name capital I changed lower case it is run but why this kind of error gives me ı dont understand
Member-2338430 12-Feb-12 13:53pm    
I will change all data lower case?

1 solution

If so, it simply means that the result of your query is empty.

Now, an important note for you: You are compose your query using string concatenation. This is bad. 1) first, repeated string concatenation is ineffective because string is immutable; 2) more importantly, this method of making a query is considered to be vulnerable to SQL injection; you should use parametrized query instead.

See also:

http://en.wikipedia.org/wiki/SQL_injection[^],
http://msdn.microsoft.com/en-us/library/ms254953.aspx[^];

http://stackoverflow.com/questions/652978/parameterized-query-for-mysql-with-c-sharp[^],
http://www.dailycoding.com/Posts/addparameterizedqueriesinmysqloledb.aspx[^].

—SA
 
Share this answer
 
v2
Comments
Member-2338430 12-Feb-12 14:07pm    
ok ı agree with you thanks your advice but this error coming for this
mysql column type utf8 turkish ci
surname capital for example JOHN father name capital I changed lower case john it is run but why this kind of error gives me ı dont understand exchance upper case to lower case in my mysql column so it is working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900