I am having the following issue. In a table I have a string which by default is empty, type nvarchar(2). When I run select query, it does not display any data despite I have filled the table if in WHERE condition I put that column. See below the sql query
DataList1.DataSource = GetData("SELECT * FROM (SELECT TOP 1 * FROM tblTestDetail) td JOIN tblIntrebare ti ON td.IdIntrebare = ti.IdIntrebare WHERE (td.Corect IS NULL OR td.Corect='')");
if (DataList1 != null)
{
DataList1.DataBind();
}
else
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('No Data')", true);
}


If I use the same query but WHERE condition td.Corect='NU' I get the data displayed. What am I doing wrong?

Marius VasilePosted Aug 18, 2023, 9:07 AM
Thank you Saravanan, again general comments.
It seems the query works but what I want to achieve is get the first row in the table that have Corect null or empty. That is getting only first row, total rows are 5. So the problem is different, I will address in a different question.