Intermediate Questions -- Flow Exception

  • Thread starter Thread starter Raymond Chiu
  • Start date Start date
R

Raymond Chiu

Dear All,

I don't know why the case below flow exception "String should be one
character......"
I don't remember the exact exception string.
But it works before. Now it always flow exception in the following line.
IList<MemberDto> members = query.ToList<MemberDto>();

Please help!!!!!!!!!!!!!!!!!!!!

-------------------------------------------------------------------------------------------------------
public static string GetMemberStatus(string Id_No)
{
try
{
CommonDLL.IAMDataContext dcx = new
CommonDLL.IAMDataContext();

string strSql = "select * from mem_member where id_no = '" +
Id_No + "'";
IEnumerable<MemberDto> query =
dcx.ExecuteQuery<MemberDto>(strSql);

IList<MemberDto> members = query.ToList<MemberDto>();
// Flow Exception . "String should be one character........

if (members.Count > 0)
return members[0].Status.ToString();
else
return null;
}
catch (Exception ex)
{
ILog Clogger = log4net.LogManager.GetLogger("Engine.Log");
Clogger.Debug(ex.Message);
return null;
}
}
 
 Dear All,

I don't know why the case below flow exception "String should be one
character......"
I don't remember the exact exception string.
But it works before. Now it always flow exception in the following line.
                IList<MemberDto> members = query.ToList<MemberDto>();

Please help!!!!!!!!!!!!!!!!!!!!

---------------------------------------------------------------------------­----------------------------
public static string GetMemberStatus(string Id_No)
        {
            try
            {
                CommonDLL.IAMDataContext dcx = new
CommonDLL.IAMDataContext();

                string strSql = "select * from mem_member where id_no = '" +
Id_No + "'";
                IEnumerable<MemberDto> query =
dcx.ExecuteQuery<MemberDto>(strSql);

                IList<MemberDto> members = query.ToList<MemberDto>();
                // Flow Exception . "String should be onecharacter........

                if (members.Count > 0)
                    return members[0].Status.ToString();
                else
                    return null;
            }
            catch (Exception ex)
            {
                ILog Clogger = log4net.LogManager.GetLogger("Engine.Log");
                Clogger.Debug(ex.Message);
                return null;
            }
        }


Your DBML definition of object MemberDto has properties of type Char
(1) when they should be String.

Regards,

Sphere 10 Software (www.sphere10.com)
File Server Migrator - Copy Local Users and Groups
http://www.sphere10.com/fileservermigrator/
 
Back
Top