1

I have been looking everywhere and have been unable to find an answer to this question, I am probably looking for the wrong thing but I thought I should try here.

When I'm programming I interact with SQL databases using SqlConnection and SqlCommand to connect and run stored procedures. However I have seen others, such as my boss (who programs in VB), using a Dataset.xsd file which allows you to build in table adapters that you can easily reference in code. I am new to programming however all the tutorials I have seen online use the SqlCommand method but the .xsd seems so much better to visualise and use, is there any downside to this method and why doesn't anyone but MSDN seem to reference it?

Source: https://msdn.microsoft.com/en-us/library/d7125bke.aspx Top section Dataset.xsd, Bottom section SqlCommand

(Apologies if this has already been asked... It seems like it should have but I cant find it anywhere)

d219
  • 2,707
  • 5
  • 31
  • 36
  • Look into the answer given in the below link http://stackoverflow.com/questions/1083193/whats-better-dataset-or-datareader – Panna Ahmed Nov 24 '15 at 08:21
  • 1
    Using plain ado.net has the advantage that you'll find more help on SO. A strongly typed dataset has some adantages but it's not a real O/RM framework like entity framework, even Linq-To-Sql is much more powerful. It's also very easy to do the wrong things with DataSets. You'll start loading all into memory instead of using the database which can cause performance problems or synchronization/locks issues. – Tim Schmelter Nov 24 '15 at 08:22

2 Answers2

0

If I'm not mistaken that way of interacting is done by visually drag'n drop your connection.

The reason why you'll find more information about sql connection and sqlcommands is because of performance. Datasets are more bloated but for small programs they're fine. As long as you don't ask a lot of data you won't have any problems with it.

Hope this is what you're looking for.

Samyne
  • 308
  • 1
  • 13
  • 1
    DataSets aren't less efficient per se. They are also usign ADO.NET behind the scenes. The reason why they might hurt performance is that it's easy to abuse them. You can start loading everything into memory since it's so handy to have all in DataTables. But performance is not the main problem. It's about the offline nature and therefore synchronization issues. – Tim Schmelter Nov 24 '15 at 08:36
0

Short answer is Performance and you have more functionality than the xsd file XSD is actually a standard for creating XML file

Long Answer:

  1. DataSet will be an in-memory object;it allows you to carry around a disconnected set of data and work with it - but you will incur the cost of carrying the bucket (so best to keep it to a size you are comfortable with).

  2. When you come further into development you will see concept of Unit Testing, its quite difficult to do unit test with the XSD files.

XSD approach is miss calculated as ORM but its not really entity framework

Sanu Antony
  • 364
  • 4
  • 15