G
Guest
Hello Everyone:
I have a feeling this is very basic, and something I am just overlooking.
The dr.Read() ALWAYS is being translated to false in the code below. I print
out the sSQL statement using the watch window, and paste that into Query
Analyzer: and I confirm the data does indeed exist. What am I missing?
Why, regardless of the data, does my dr.Read() alway equal false?
-----------------------------------------------------------------------------------------------
CODE SNIPPE
-----------------------------------------------------------------------------------------------
sSQL = "SELECT i_OrderID FROM tOrder WHERE sPOrder = " + sPONumber;
SqlConnection oConn = new SqlConnection(connStr());
SqlCommand oCommand = new SqlCommand(sSQL, oConn);
oConn.Open();
SqlDataReader dr = oCommand.ExecuteReader();
if(dr.Read())
{
....Code Removed
}
else
{
....Code Removed
}
I have a feeling this is very basic, and something I am just overlooking.
The dr.Read() ALWAYS is being translated to false in the code below. I print
out the sSQL statement using the watch window, and paste that into Query
Analyzer: and I confirm the data does indeed exist. What am I missing?
Why, regardless of the data, does my dr.Read() alway equal false?
-----------------------------------------------------------------------------------------------
CODE SNIPPE
-----------------------------------------------------------------------------------------------
sSQL = "SELECT i_OrderID FROM tOrder WHERE sPOrder = " + sPONumber;
SqlConnection oConn = new SqlConnection(connStr());
SqlCommand oCommand = new SqlCommand(sSQL, oConn);
oConn.Open();
SqlDataReader dr = oCommand.ExecuteReader();
if(dr.Read())
{
....Code Removed
}
else
{
....Code Removed
}