why not?

  • Thread starter Thread starter ISMAILRAJPUT
  • Start date Start date
I

ISMAILRAJPUT

this.oleDbSelectCommand2.CommandText = "SELECT kitaab, waraq FROM shajra
WHERE mahal = '" + comboBox1.SelectedItem.ToString() + "' ANDperi LIKE '%" +
textBox4.Text.ToString() + "%'";

this.oleDbSelectCommand2.Connection = this.oleDbConnection1;

this.oleDbDataAdapter2.Fill(dataSet2 , "mydata2");

textBox1.Text = dataSet2.Tables["mydata2"].Rows.Count.ToString();



why this code is not returning any rows even if there are appropriate
records in the table? i think problem is with like operator because without
like operator it works fine . Give me some idea
 
do not consider this

ANDperi LIKE


there is a space between AND and peri in real code
=====================================================
 
Have you tried running this query directly against the db (not through code)
to see if it returns any rows?
If you are using SQL Server you can use the query tool.
You can step into the code and get the exact query that is being run and
copy/paste it into the query tool window and run it.
HTH
JB
ISMAILRAJPUT said:
do not consider this

ANDperi LIKE


there is a space between AND and peri in real code
=====================================================
ISMAILRAJPUT said:
this.oleDbSelectCommand2.CommandText = "SELECT kitaab, waraq FROM shajra
WHERE mahal = '" + comboBox1.SelectedItem.ToString() + "' ANDperi LIKE
'%"
+
textBox4.Text.ToString() + "%'";

this.oleDbSelectCommand2.Connection = this.oleDbConnection1;

this.oleDbDataAdapter2.Fill(dataSet2 , "mydata2");

textBox1.Text = dataSet2.Tables["mydata2"].Rows.Count.ToString();



why this code is not returning any rows even if there are appropriate
records in the table? i think problem is with like operator because without
like operator it works fine . Give me some idea
 
There was no problem in the code , In the morning when i started my computer
again.it was working fine.


John Baro said:
Have you tried running this query directly against the db (not through code)
to see if it returns any rows?
If you are using SQL Server you can use the query tool.
You can step into the code and get the exact query that is being run and
copy/paste it into the query tool window and run it.
HTH
JB
ISMAILRAJPUT said:
do not consider this

ANDperi LIKE


there is a space between AND and peri in real code
=====================================================
ISMAILRAJPUT said:
this.oleDbSelectCommand2.CommandText = "SELECT kitaab, waraq FROM shajra
WHERE mahal = '" + comboBox1.SelectedItem.ToString() + "' ANDperi LIKE
'%"
+
textBox4.Text.ToString() + "%'";

this.oleDbSelectCommand2.Connection = this.oleDbConnection1;

this.oleDbDataAdapter2.Fill(dataSet2 , "mydata2");

textBox1.Text = dataSet2.Tables["mydata2"].Rows.Count.ToString();



why this code is not returning any rows even if there are appropriate
records in the table? i think problem is with like operator because without
like operator it works fine . Give me some idea
 
Back
Top