I'm doing the following block of code and the compiler is complaining about unassigned local variables and could use some help identifying what's up.
while (rsData.Read())
{
if (rsData["TYPE"] != DBNull.Value)
strType = rsData["TYPE"].ToString().Trim();
if (strType == "01")
{
if (rsData["Text"] != DBNull.Value)
strwho = rsData["Text"].ToString();
if ((strwho.Length < 10 || (strwho.IndexOf("NULL") > 1)))
strwho = "";
}
else if (strType == "07")
{
if (rsData["Text"] != DBNull.Value)
strmetades = rsData["Text"].ToString();
if ((strmetades.Length < 10 || (strmetades.IndexOf("NULL") > 1)))
strmetades = "";
}
It complains on all of the 'if (strType == "01")' lines and I'm not sure what's up. I've thought of using a switch for this but that seems to get the same issue also.
Any ideas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…