小编vin*_*inz的帖子

LinQ查询多个表并提取数据

我正在对内连接4表进行查询,我必须提取数据并转换为字符串并将其放入数组中.

    var query = from a in context.as
                            join b in context.bs on a.prikey equals b.forkey
                            join c in context.cs on b.prikey equals c.forkey
                            join d in context.ds on c.prikey equals d.forkey
                            where b.gender == gender
                            where c.age == age
                            select new
                            {
                                a.Name,
                                a.Age,
                                b.Gender,
                            };
string[] results = new string[] {}
return results;
Run Code Online (Sandbox Code Playgroud)

通常,如果涉及单个表,则a =表a的复数

as t = query.First() 
string[] results = new string[] {t.Name, t.Age, t.Gender}
return results;
Run Code Online (Sandbox Code Playgroud)

我错过了提取数据的步骤.

c# linq

6
推荐指数
1
解决办法
2万
查看次数

拆分字符串并在php中形成一个新字符串

我如何将一个字符串例如"A,B,C,D"的形式拆分为一个新的字符串"ABC D"在PHP?

非常感谢!explode将形成一个数组,str_split需要长度.

php string split

0
推荐指数
1
解决办法
101
查看次数

标签 统计

c# ×1

linq ×1

php ×1

split ×1

string ×1