Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Store and retrieve list of structures

Store and retrieve list of structures

Scheduled Pinned Locked Moved C#
database
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Reza Shojaee
    wrote on last edited by
    #1

    Hi there I have a variable that its type is list of structure. My structure is like below :

    public struct Order
    {
    public string name;
    public int amount;
    public double price;
    public List<string> toppings;
    }

    And my variable is like below :

    public static List<Order> myorder = new List<Order>();

    I have SQL database for my program. and I need store myorder variable to database. If you know appropriate solution for it, please tell me.

    Best Regards, Reza Shojaee

    L 1 Reply Last reply
    0
    • R Reza Shojaee

      Hi there I have a variable that its type is list of structure. My structure is like below :

      public struct Order
      {
      public string name;
      public int amount;
      public double price;
      public List<string> toppings;
      }

      And my variable is like below :

      public static List<Order> myorder = new List<Order>();

      I have SQL database for my program. and I need store myorder variable to database. If you know appropriate solution for it, please tell me.

      Best Regards, Reza Shojaee

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You'd use an INSERT[^] statement to write the contents of your structure to the appropriate table. Is there already a table called "Orders" (or something similar) in your database?

      I are Troll :suss:

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups