Solved

SQL Data Source for Windows Forms (Applications)?

Posted on 2008-06-14
2
1,639 Views
Last Modified: 2013-11-27
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
Comment
Question by:garethh86
2 Comments
 
LVL 34

Accepted Solution

by:
Sancler earned 500 total points
ID: 21787996
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
 
LVL 7

Author Closing Comment

by:garethh86
ID: 31467168
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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question