none
data import app RRS feed

  • Question

  • Hi

    I am quite new to c# and i want some opinions on how I can implement a data import implication, but I think  it is more than just C#...  The application should take an XML file and push the content into SQL database. The XMLs will be generated and stored in a folder. The application will have to go through a list of PCs and scan those folders. 

    With my limited knowledge to programming, my plan would just to make an app using Winforms and run the app on a server. The idea why I want to run on the server so it is easier to managed if anything goes wrong that is: I have to restart just one app as opposed to 10 clients. 

    I just wanted to get a advice of how you would approach this problem?  Would services (WCF) be applicable here?

    Many many thanks!

    Sunday, July 7, 2019 11:59 AM

Answers

  • I would begin by writing a program that enumerates the systems in the network. Probably a console program, even if the final application is not to be a console. The documentation probably has such a sample already that you can use. Then write a program that enumerates the files, perhaps just for one directory, not for all directories. Nearly all relevant samples (there are many) use recursion to enumerate files but it is possible to use iteration (not recursion) as in Iteratively Processing Recursive Data, Such As Directories - TechNet Articles - United States (English) - TechNet Wiki. Then write a program that reads a XML file; there are multiple ways to do that. Note that it is possible to copy XML data to the clipboard and then go to a C# file in VS and then use a special way in the edit menu to paste the XML as classes that then can be used to read (desalinize) the relevant XML. You can write a program that does just one specific file. You can write another program, or use the program that reads the XML, to write to the database. Then you can put all that together in your final program.


    Sam Hobbs
    SimpleSamples.Info

    • Marked as answer by JonasLub Sunday, August 4, 2019 9:31 PM
    Sunday, July 7, 2019 6:45 PM
  • You should begin by describing the requirements more thoroughly than here. Then describe how to do it technically then determine how to do each of the multiple things. After attempting to determine how to do each of the multiple things yourself you can ask for help with those that you need help with. When you do, describe what you have done to attempt to solve the problem yourself.

    The following are separate things that should be researched and if you still need help with any of them then they should be asked separately.

    • enumerate systems in the network
    • enumerate files in a system
    • read an XML file
    • write to a database



    Sam Hobbs
    SimpleSamples.Info

    • Marked as answer by JonasLub Sunday, July 7, 2019 5:42 PM
    Sunday, July 7, 2019 4:27 PM

All replies

  • For inserting see the following post.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/ddead393-db59-4761-989b-77caa8ea55ad/best-way-to-insert-xml-data-into-sql-database-through-c?forum=csharpgeneral


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Sunday, July 7, 2019 12:24 PM
    Moderator
  • You should begin by describing the requirements more thoroughly than here. Then describe how to do it technically then determine how to do each of the multiple things. After attempting to determine how to do each of the multiple things yourself you can ask for help with those that you need help with. When you do, describe what you have done to attempt to solve the problem yourself.

    The following are separate things that should be researched and if you still need help with any of them then they should be asked separately.

    • enumerate systems in the network
    • enumerate files in a system
    • read an XML file
    • write to a database



    Sam Hobbs
    SimpleSamples.Info

    • Marked as answer by JonasLub Sunday, July 7, 2019 5:42 PM
    Sunday, July 7, 2019 4:27 PM
  • Thanks for the replies. All you have good answers. 
    Sunday, July 7, 2019 5:40 PM
  • I would begin by writing a program that enumerates the systems in the network. Probably a console program, even if the final application is not to be a console. The documentation probably has such a sample already that you can use. Then write a program that enumerates the files, perhaps just for one directory, not for all directories. Nearly all relevant samples (there are many) use recursion to enumerate files but it is possible to use iteration (not recursion) as in Iteratively Processing Recursive Data, Such As Directories - TechNet Articles - United States (English) - TechNet Wiki. Then write a program that reads a XML file; there are multiple ways to do that. Note that it is possible to copy XML data to the clipboard and then go to a C# file in VS and then use a special way in the edit menu to paste the XML as classes that then can be used to read (desalinize) the relevant XML. You can write a program that does just one specific file. You can write another program, or use the program that reads the XML, to write to the database. Then you can put all that together in your final program.


    Sam Hobbs
    SimpleSamples.Info

    • Marked as answer by JonasLub Sunday, August 4, 2019 9:31 PM
    Sunday, July 7, 2019 6:45 PM
  • Note that the thread Karen suggests says nothing about Entity Framework. EF takes time to learn but it can save time many times in the future.


    Sam Hobbs
    SimpleSamples.Info

    Sunday, July 7, 2019 6:48 PM
  • Thanks. 

    You gave some food for thought. 

    Sunday, August 4, 2019 9:39 PM