Example #1
0
        internal B2b_companyindustry GetIndustryById(int id)
        {
            string sql = "select id,industryname,remark from b2b_companyindustry where id=" + id;

            try
            {
                var cmd = sqlHelper.PrepareTextSqlCommand(sql);
                using (var reader = cmd.ExecuteReader())
                {
                    B2b_companyindustry u = null;

                    if (reader.Read())
                    {
                        u = new B2b_companyindustry()
                        {
                            Id           = reader.GetValue <int>("id"),
                            Industryname = reader.GetValue <string>("industryname"),
                            Remark       = reader.GetValue <string>("remark")
                        };
                    }
                    return(u);
                }
            }
            catch
            {
                return(null);
            }
        }
Example #2
0
        internal B2b_companyindustry GetIndustryByComid(int comid)
        {
            string sql = "SELECT [id] ,[industryname] ,[remark] FROM [EtownDB].[dbo].[b2b_companyindustry] where id =(select com_type from b2b_company where id=" + comid + ")";

            try
            {
                var cmd = sqlHelper.PrepareTextSqlCommand(sql);
                using (var reader = cmd.ExecuteReader())
                {
                    B2b_companyindustry u = null;

                    if (reader.Read())
                    {
                        u = new B2b_companyindustry()
                        {
                            Id           = reader.GetValue <int>("id"),
                            Industryname = reader.GetValue <string>("industryname"),
                            Remark       = reader.GetValue <string>("remark")
                        };
                    }
                    return(u);
                }
            }
            catch
            {
                return(null);
            }
        }