• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1811
  • Last Modified:

SQL Data Source for Windows Forms (Applications)?

Heya

I've recently started playing around with building windows apps using VS2008 and although I can code sql connections, commands etc. manually there doesn't seem to be something like the SQL Data Source manager you get when building web apps. I see the Dataset can hold queries for you but it all seems a bit code heavy. Can anyone point me towards some good tutorials for building data connected based windows apps with SQL server?

The SQL Data Source in web apps has optimistic concurency, couldn't see anything like this in dataset, I take it this would have to be coded manually in a windows app?

Many thanks!
0
garethh86
Asked:
garethh86
1 Solution
 
SanclerCommented:
As I don't do Web apps, I may be on the wrong tack, but it sounds to me as though the equivalent to what you're seeking in WinForms is provided by the Data Sources tab in Solution Explorer.  If, on that, you click on Add New Data Source it will run a Wizard enabling you to choose a server, database, tables, etc and the the Designer creates the necessary objects - dataset, connection, adapters.  Although the auto-generated code is based on DATAAdapters, it "wraps" them up in TABLEAdapters: that means they are less familiar.  If you prefer to work with DATAAdapters directly, there is a configuration wizard for those, too.  In the Toolbox, right click on the Data tab and then on Choose Items ... and select an SQLDataAdapter.  When that has appeared in the Toolbox, if you drag it to your form it will start the wizard for that.

As to Optimistic Concurrency, that's the default approach in ADO.NET.  This is a good starting point.

http://msdn.microsoft.com/en-us/library/aa0416cz.aspx

Although that describes how to implement it in code you will, if you use any of the wizards to configure data sources and then examine the code the designer produces, find that that is the approach that they implement.

Roger
0
 
garethh86Author Commented:
Nice one, thanks, played around with this is VS and it is fairly similiar, I first went in, didn't see sqldataadapter and panicked!
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now