小编use*_*231的帖子

无法创建"匿名类型"类型的常量值

我有两个linq查询.我想在另一个查询中使用一个查询的结果.

var t2s = (from temp3 in _ent.Products                       
           where temp3.Row_Num == 2
           select new { temp3.ProductID });
Run Code Online (Sandbox Code Playgroud)

然后我在另一个查询中使用此var:

var _query = (from P1 in _ent.brands
              join temp2 in on 
                  new { Produ_ID = (Int32?)P1.Prod_ID } 
                  equals new { Produ_ID = (Int32?)temp2.ProductID }
             );
Run Code Online (Sandbox Code Playgroud)

当我自己运行第一个查询时,它给了我正确的结果.如果我运行第二个没有join它给我正确的结果,但有一个join给我以下错误:

错误:无法创建"匿名类型"类型的常量值.在此上下文中仅支持原始类型(例如Int32,String和Guid')

.net c# linq-to-entities entity-framework anonymous-types

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

Soap调用在c#中给出500(内部服务器错误)

我有一个联盟帐户,我需要soap打电话来获取数据.我从一个站点获得了准备好的代码,我尝试应用它,但我得到了500(internal server error).我的代码如下.

public void getdata()
{
    var _url = "http://secure.directtrack.com/api/soap_affiliate.php";
    var _action = "http://secure.directtrack.com/api/soap_affiliate.php/dailyStatsInfo";

    XmlDocument soapEnvelopeXml = CreateSoapEnvelope();
    HttpWebRequest webRequest = CreateWebRequest(_url, _action);
    InsertSoapEnvelopeIntoWebRequest(soapEnvelopeXml, webRequest);

    // begin async call to web request.
    IAsyncResult asyncResult = webRequest.BeginGetResponse(null, null);

    // suspend this thread until call is complete. You might want to
    // do something usefull here like update your UI.
    asyncResult.AsyncWaitHandle.WaitOne();

    // get the response from the completed web request.
    string soapResult;
    using (WebResponse webResponse = webRequest.EndGetResponse(asyncResult)) …
Run Code Online (Sandbox Code Playgroud)

c# soap

4
推荐指数
3
解决办法
3万
查看次数