The title speaks for itself. I'm building a winforms C# 2.0 app. Any tutorials or inspiring ideas?
ADO.NET is a big topic - but the keywords to search for here are SqlConnection
, SqlCommand
, SqlDataReader
, etc. If you like DataSet
(I'm not a fan, but some people love them), then the dataset designer will do a lot for you.
Another option is to use a .NET 2.0 web-service (asmx) for data access via a central app-server - making it a "smart client".
With later .NET versions, WCF (.NET 3.0), LINQ-to-SQL (.NET 3.5), Entity Framework (.NET 3.5 SP1) and ADO.NET Data Services (.NET 3.5 SP1) become options.
upgrade to C# 3.5 and use a Add->New Item->Linq to Sql Class... by far the easiest way i've ever seen, you can just drag from server explorer the tables you want... otherwise...
it's much more difficult in 2.0 until you get your rythym down, As previous poster i'd recommend SqlConnection and SqlDataReader, etc. Before .NET 3.5 we had an ancient helper method that simply did something like the following
DataAccessLayer dal = new DataAccessLayer("Connection String"); SQLDataReader sr = dal.getDataReader("SQLCOMMANDSTRING"); sr.Close(); dal.runProcess("SQLCOMMANDSTRING");
etc..
for some specifics on how to use the SQL objects check the following: http://www.developerfusion.com/article/4278/using-adonet-with-sql-server/2/
There's not much difference between a local SQL Server instance and a distant one. You just set something like Server=sqlserver.remote-machine.com
in your connection string.