.NET Programming

132K

Solutions

38K

Contributors

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi Experts!

Need your help updating LINQ query.

The LINQ query should return a distinct record of locationId and phonenumber.
Then which need to extract locationId and phonenumber and store it in local variables.

SQL Query:

SELECT DISTINCT  
       personlocation.LocationID,
       phone.PhoneNumber
FROM dbo.personProducts pp
     INNER JOIN dbo.personPhonesLocations phoneLocation ON pp.personLocationRecID = phoneLocation.personLocationRecID
     INNER JOIN dbo.personLocations personlocation ON pp.personLocationRecID = personlocation.personLocationRecID
     INNER JOIN dbo.Phones phone ON phoneLocation.PhoneID = phone.PhoneID
     INNER JOIN dbo.PhoneTypes PhoneTypes ON pl.PhoneTypeID = PhoneTypes.PhoneTypeID
WHERE pp.PersonNumber = 'ABC123'
      AND PhoneTypes.PhoneTypeName = 'Contact Number'

Open in new window


C# method:
var personPhone = (from pp in dataContext.personProducts
from phoneLocation in dataContext.personPhonesLocations
from personLocation in dataContext.personLocations
from phone in dataContext.Phones
from phoneType in dataContext.PhoneTypes
where pp.PersonNumber == "ABC123" && phoneType.PhoneTypeName == "Contact Number"
select new
{
LocationId = personLocation.LocationID,
phonenumber = phone.PhoneNumber
}).Distinct();


if (personPhone != null)
{
    string locationId = ???; <-- need help
    string phonenumber = ??  <-- need help

}

Open in new window


TIA!
0
[Webinar] Learn How Hackers Steal Your Credentials
LVL 9
[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

I inherited a C# application.  The development environment is Win10 64 bit, VS 2012 and the development machine has Microsoft Office Pro 2016 installed.  The problem is that the C# application has a lot of references to Microsoft.Office.Interop.Word which utilizes MS Office 2003 if I recall correctly (version 11 as opposed to version 14).

I can't get past this build error which states:

Assembly 'Microsoft.Office.Interop.Word, Version 14.0.0.0, culture = neutral, Public Key Token.......' which is a higher version than referenced assembly 'Office, Version=11.0.0.0, Culture neutral....."

I cannot remove the reference to either assembly without breaking a significant amount of the existing code.  I originally tried installing both and setting the 'Embed Interops Types = False' at the recommendation of .Net but that did not resolve the issue.

Any suggestions?
0
We have a website and we want to record some instructions --> open the site, login, go thru the menus, etc. Like an instruction video.

Someone tried Webex, it didn't work (he said he gave up). Another tried Skype but couldn't get it working.

I found this that's free download  https://www.bandicam.com/  (they have a paid version too)

That works but anyone has used it? I don't know how to record my voice.

Any other tools I can use?
0
I see alert message "Process cannot access the file because it is being used by another process".
when I click the button at third time. It seems reading is okay. but when i click the button to write something inside  to the xml.
it fails. how can i resolve this issue?


 protected void Page_Load(object sender, EventArgs e)
        {
            phoneNoList.DataSource = Utility.Controller.GetUniquePhoneNo(fromPhoneNo);
            phoneNoList.DataBind();
}

  protected void sendMsg_Click(object sender, EventArgs e)
        {
		 #region add a record to all message xml
                Domain.User u = new Domain.User();
                u.fullName = fullName.Text;
                u.from = "+1" + fromPhoneNo;
                u.to = "+1" + toPhoneNo.Text;
                u.body = body.Text;
                u.dateTimeSent = DateTime.Now.ToString();
                u.direction = "outbound-reply";
                string result = Utility.XML.Add(Utility.Controller.filePathUserMessagesAll, u);
                #endregion


}

  public static string Add(string inputFilePath,Domain.User u)
        {
            XDocument doc = XDocument.Load(inputFilePath);
            XElement user = new XElement("User",
                new XAttribute("PhoneNo",""),
                new XElement("FullName",u.fullName),
                new XElement("From",u.from),
                new XElement("To",u.to),
                new XElement("Body",u.body),
                new 

Open in new window

0
The following code has two counters. One runs directly from the form (in the main thread) and another is performed by a BackgroundWorker. Interestingly, the two counts do occur at the same time (which is the intent...win!) but the progressbar doesn't change at all until after the BackgroundWorker has finished. Of course, I'd like the progressbar to update during the counting. Help?

Note: The code below is just a test I'm performing so I can take the structure and expand it to a real-world, time-consuming, stored-proc.
Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.ProgressBar1.Maximum = 10
    End Sub

    Private Sub btnHeavyTask_Click(sender As Object, e As EventArgs) Handles btnHeavyTask.Click
        Debug.Print("Starting to count now")
        BackgroundWorker1.WorkerReportsProgress = True
        BackgroundWorker1.RunWorkerAsync()
        mainThreadTask()
    End Sub

    Private Sub mainThreadTask() 
        Dim i As Integer = 0

        Do Until i = 15
            Me.txtHeavyTask.AppendText(vbCrLf + i.ToString)
            Me.txtHeavyTask.Refresh()
            Threading.Thread.Sleep(500)
            i += 1
        Loop

        Me.txtHeavyTask.Text = "Done"
    End Sub

    Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
        Dim i As Integer = 1

        Do Until i = 10
            

Open in new window

0
I sometimes notice one or more icons with an Expert's picture at the bottom of my questions with the label Viewing. I am just curious and wondering what does that indicate.
0
Hi Experts! I have no idea how to debug this issue.... Any help would be appreciated!

I have a client who sends shipments to UPS to get Tracking information and status, etc. Occasionally they have to void an airbill... all the functions work as desired with the exception of the "void" switch.

For example:

Z:\UPS\NewUPS.exe track << works great

Z:\UPS\NewUPS.exe ship << works great

Z:\UPS\NewUPS.exe void << Throws the error (was working a few months ago)


Error Message

 .Net Framework Error:


See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Runtime.InteropServices.SEHException: External component has thrown an exception.
   at System.Data.Common.UnsafeNativeMethods.IDBInitializeInitialize.Invoke(IntPtr pThis)
   at System.Data.OleDb.DataSourceWrapper.InitializeAndCreateSession(OleDbConnectionString constr, SessionWrapper& sessionWrapper)
   at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
   at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
   at …
0
I had this question after viewing Looking for a new laptop.

I'm looking at Lenovo X1 that "Experienced Member" (I love the username :)) suggested (here is the link http://www3.lenovo.com/ca/en/laptops/thinkpad/thinkpad-x/X1-Carbon-5th-Generation/p/22TP2TXX15G)

I wonder if Amazon has it. I looked and one came up.

Should I choose "Windows Home 10" Or "Pro"? this is the screenshot
laptop
0
I have a client that hosts a lot of websites for his own clients.  The websites all have the basic "contact us" type email form where you put in a name, a number, email address and a basic message.  When you submit it uses the email address entered as the sender.  It seems this is where things get strange.  On the actual web server, there is also a Windows 2016 SMTP that is used to just send these out, the .net dll just drops the file locally into the pickup folder and off it goes.  Then suddenly we have been geting a "connection timed out" response where the outside domain is not responding.

Any idea where things can be going wrong?
0
Hi,

I have just started trying to learn Visual Basic 2015 and the book I am using has in the code instructed me to use the following code :

"Val" to convert a text string; and
"Me" to reference the current form

Neither of which are recognisied by Visual Basic 2015.

    private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            Sum.Text = Val(Num1.Text) + (Val(Num2.Text));
        }
    }
}



  public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Me.Text = InputBox("Enter a Caption...")
        }

    }
}
0
On Demand Webinar: Networking for the Cloud Era
LVL 9
On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

I'm looking to buy a new laptop. I want it to be light and to use for .Net development. It needs to be light.

On my current laptop, I have:  VS 2013 and VS2015 (community), SQL 2014 and SQL 2016 (developer editions)

1. No Toshiba. I already have one and don't like it. It's not for development.  I got it maybe 4 yrs ago.

2. I have a gaming laptop. It's MSI but it's so heavy and running out of disk space when I installed SQL 2016.

3. At work, we have Dell laptops. Seems like a good laptop but screen is too small. At my previous job, my coworker had Surface but again, the screen was too small. I think 15 inch screen would be good.

4. I know I need SSD and i7 processor
Is this a good one? Any recommendations?
Dell Latitude E7470 Business Ultrabook 14 Inch i7-6600U 16GB DDR4 Windows 10 Pro (256G)
1
I'm trying to implement a restful architecture using .NET Core based on HATEOAS.

For that, I would be using an include parameter with a list in the GET requests so as to include the entities related to the parent.

For example, if I want to get a master (master/details) with the related client I would perform the following GET request:

GET http://api.com/master/id=1?include=Client

Open in new window

If the include clause is not there, the related client in the master will only show the link to get it.

The will happen with every related entity.

What I'm trying to find out is the best way to implement this in my base resource's class.

The solution I applied is to use a base class using generics:

public class InstanceResource<T> where T : BaseResource
{
    public string Href { get; set; }

    public string ClassName { get; set; }

    [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
    public T Object { get; set; }
}

Open in new window

Using this, I will have a Master with a InstanceResource related to it.

The object property of InstanceResource<Client> is the actual Client object. If Client is not included in the Include clause of the GET request, the object will be null and it will only show Href and ClassName.

GET http://api.com/master/id=1?include=Client
{
  "object": {
    "client": {
      "object": {
        "name": "JOHN DOE"
      },
      "href": "http://api.com/client/1",
      "className": "Client"
    },
    "details": {
      "href": "http://api.com/details/masterId=1",
      "className": "Collection<Detail>"
    }
  },
  "href": "http://api.com/master/1",
  "className": "Master"
}

Open in new window

Not included Client:

GET http://api.com/master/id=1

{
  "object": {
    "client": {
      "href": "http://api.com/client/1",
      "className": "Client"
    },
    "details": {
      "href": "http://api.com/details/masterId=1",
      "className": "Collection<Detail>"
    }
  },
  "href": "http://api.com/master/1",
  "className": "Master"
}

Open in new window

As you can see, this approach uses a container class to represent the resource. What I need to know if this solution has any disadvantage.

I saw other solutions where all the properties of the Object are at the same level that Href. Something like this:


Open in new window

0
In my winforms .NET app I have a webbrowser control that I provide the code Paypal gave me for the button to have them make a purchase. Everything is fine until after they click on the button and it then informs them their "browser" is out of date and won't proceed. What can I do to this string to get them to PayPal site in this control?

WebBrowser1.DocumentText = "<form action=""https://www.paypal.com/cgi-bin/webscr"" method=""post"" target=""_top""> <input type=""hidden"" name=""cmd"" value=""_s-xclick""> <input type=""hidden"" name=""hosted_button_id"" value=""VXKQ9SM3HLK52""> <table> <tr><td><input type=""hidden"" name=""on0"" value=""Product Code"">Product Code</td></tr><tr><td><input type=""text"" name=""os0"" maxlength=""200""></td></tr> </table> <input type=""image"" src=""https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif"" border=""0"" name=""submit"" alt=""PayPal - The safer, easier way to pay online!""> <img alt="""" border=""0"" src=""https://www.paypalobjects.com/en_US/i/scr/pixel.gif"" width=""1"" height=""1""> </form> "

Open in new window

0
Hi there !

I would like to write separate method to compare 2 objects created from 2 different classes but both classes have similar property names.

Sample code:
ClassA
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string StreetName { get; set; }
}


ClassB
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Address { get; set; }
}

Open in new window

Now, the output of custom method shud do following:
* returns true when similar property names hold same values in ClassA & ClassB objects.
* vice versa, returns false when similar property names DO NOT hold same values in ClassA & ClassB objects.
* In both above scenarios, just skip what values are hold in different property names and continue.

Also I would like to know if there any Nuget packages or any external tool available by which we can achieve above without writing any code.

Thanks in advance
0
I am lead buyers and now look for software that I can have the lead seller to send me into lead management software or crm so I can do some distributions and pricing structure on the middle ....

Have suggestions any lead vendors software I can use?
0
Do you know any out of box solution that can get map shown
Different place type !? I am looking for a way to show a map that have campground,  national park, theme park, and any small local park

I also look for a map to show all local events

I understand we can use API google map but try to get something up without impacting too much customized coding

We use it on aspnet c# thanks
0
Anyone knows how to get year, model, and maker for all Rv or motorhome or trailers? I have a project to build website that need to get Rv information for insurance quote ...


Thanks
0
Do u know any API or database I can get for my website that I want to build? I am building website that doing auto car insurance in c# n aspx

Thanks
0
Any experts know how to send and receive pictures in web form aspx ? Called mms

Thanks
0
PeopleSoft Has Never Been Easier
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Hi,
To this site
http://my-friend.co/Test_rec4/Default.aspx?userid=mc23

I want to decrease the width of the highlighted area (in red), and increase the width of the area (highlighted in yellow), and to put two more buttons (under current Delete button). Can you please show me the change for these?
16j.png
0
Hi Experts,

We have a folder 1 in a network drive.And folder 2 containing 15 different folders say f1 to f15.
Some third party sources put in files which may be upto 150 in number in a day into folder 1.
Each file is named such a way that it had destination folder name within uts name like f1p1data.csv, f3p2data.csv, f1p2data.csv etc.
Here f denotes which folder the file is to put and p denotes priority to be picked up..as in p1 to be picked up first and so on.There is this vbs ript code that runs this logic of putting files one by one into subfolders.The vbscript is present in my local.When ever a file gets picked up into subfolder say f1 for ex..an already existing file say available.txt in f1 folder changes into assigned.txt.A separate process which is scheduled, processes the file in f1(basically moves the file into my local drive and processes) and at last renames the assigned.txt to available.txt.And the process continues.Problem 1: since its  drive, moving file into subfolders is slow
Problem2: since files keep arriving in folder 1, the vbscript seems to be becoming slow in finding the priority file
Please suggest a better way of doing this and combatting the latency.Also suggest a alternate way of looping through as ..files are still getting copied into folder 1 when the vbscript is looping through to find top priority file from one iteration through all files present jn a given time.
0
I have a screen that a user can either enter information(about 5-6 fields) and click Add Item or they can enter in an ID(one of the fields) and click Search and it will populate all the other fields. This works great. I had RequiredFieldValidators for the fields that are mandatory(all of them) and I noticed that when I tried to do a search that the fields would have the validation messages next to them and it would never hit the code behind for the search button. Obviously the validator is working on the client side and doing its job but it wouldnt let the server side code to run? I want to have the functionality of the search button to fill the fields with data and for the RequiredFieldValidators to work when the Add Item is clicked.
 Now, I read where you can set EnableClientScript="true" in the validators(client side) and that allows the server side code to run when I click Add Item but then the validators are allowing missing fields. I tried to set the EnableClientScripts back to false but when I test and click Add Item, with no data, its saving a blank record and thats not cool!!!
Any thoughts on this? Any help would be appreciated!!!

Thanks
JK
0
I have an older website that build the home page by using an .aspx page as a frame, that includes other .aspx pages to make up the entire page. For example it is made up of about 4 different .aspx pages (i.e.: topMenu.aspx, leftPanel.aspx, righPanel.aspx, footer.aspx). These pieces are added by use of an include statement, into the HomePage.aspx.

  <!--leftPan -->
        <!--#include file ="../includes/leftPanel.aspx"-->
  <!--leftPan close -->

This is working but I need to make some changes to one of the included pages and I also need to add some C# code into the page. I've attempted to do this, based on my limited knowledge of this,  but am getting the following error:

Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30205: End of statement expected.

Source Error:


Line 1:  <Script Runat="Server">
Line 2:  		private void ibSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e)
Line 3:  		{
Line 4:  			// Get search terms


Source File: E:\Sites\Intranet\includes\leftPanel2.aspx    Line: 2


Show Detailed Compiler Output:

Show Complete Compilation Source:


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1087.0 

Open in new window


my code is below:

<Script Runat="Server">
		private void 

Open in new window

0
Hi EE,

in vb.net, I have a TreeView control.

each nodes (lets say I have 5) like this :

Apples
Tomatoes
Oranges
Grapes
Bananas


each of them has an "ID" or a "Code" in the background.  lets say its :

Apples     [0020]
Tomatoes   [0025]
Oranges     [0060]
Grapes     [0061]
Bananas    [0110]


My 2 questions are :

1) If I have a button "Add item" is it possible to add a node at the end of the tree, the user writes the name of the fruit, then he could drag the new node somewhere in between 2 fruits to place it where he wants it ?

2) since there are codes to each fruit, if user drags it in between [0025] and [0060] I would like the code to be automatically created at 0026 to be placed in between !

But it goes to another question, what If after the user creates another one and wants to place it in between of 0025 and 0026 ? now there is not space anymore between the codes ! we would have to increment of + 1 all the codes then place it in between.

so thats my issues... I realyl need help on this...
thank you.

(I am using fruits as an example but this is for work in our Logistic menu in our system. right now its not efficient, I have created the TreeView and reading values from SQL, but im stuck there for the rest)
0
Still pretty green to MVC and need some guidance on how to accomplish what was so simple in web forms. I have a dropdown filled with names from a database. Each of the records that contains those names, also contains an ID. On the same view, I have a label. What I want to do, is change the value of the label when the dropdown selection changes. A simple, static example of how to do this would be great. At the very least, I'd like to just be pointed in the right direction.
0

.NET Programming

132K

Solutions

38K

Contributors

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.