locked
Assigninig Populated class to a SQL Server Table RRS feed

  • Question

  • User-617859429 posted

    hi

    I have populated a class from different tables.

    Now i want that class to be assigned to a table (that has same fields as my class attributes) in SQL Server.

    Should i create a store pocedure and pass all class attributes as parameters and then using Insert command.

    Looking for Possible Solutions.

    Thanks

    Wednesday, September 26, 2012 12:33 PM

Answers

  • User-517651234 posted

    If your fields match up, I would create a SAVE method in the class. Within the method you could simply open a connection and save via text insert command, or (better option) access your data access layer which should already contain methods for reading from and writing to the database.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 28, 2012 12:35 PM

All replies

  • User3866881 posted

    Hello,

    Not very clear about your meaning——would you mind telling me in details about what class model you have got now? And what tables you have got and what really you wanna do? What's the expected result?

    Thanks

    Thursday, September 27, 2012 9:48 PM
  • User-517651234 posted

    If your fields match up, I would create a SAVE method in the class. Within the method you could simply open a connection and save via text insert command, or (better option) access your data access layer which should already contain methods for reading from and writing to the database.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 28, 2012 12:35 PM