Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old May 20th, 2008, 06:17 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Excellent news, I am please you are making progress. I am not trying to be a hardass with information, but rather would promote learning and discovery.

I assure you it can be done without the invisible text boxes. As a pointer, note how the data is stored in the DataSet, NOT the controls, the controls are simply linked/bound to it. So, whats to say you cant just check the value of the data in the object (DataSet) from within your code? ;)

In terms of updating, you need to tell the related DataAdapter to update the data, this is what can make DataSets efficient, they work on the data locally and then update the data in one hit rather than opening/closing/maintaining a connection.

Calling the DataAdapterName.Update(DataSetName) method should post your changes back to the DB :)

Rob
http://robzyc.spaces.live.com
Reply With Quote
  #12 (permalink)  
Old May 20th, 2008, 08:57 AM
Registered User
 
Join Date: May 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

TableAdapter vs SqlDataAdapter..?

My form load event has a single line of code:

Code:
this.vDomainNamesTableAdapter.Fill(this.domainsDataSet.vDomainNames);
I've noticed this is a tableAdapter. It seems to be what loads the dataset from SQL Server when the form opens. It doesn't have an Update() method in intellisense though..
So I must assume you're talking about a SqlDataAdapter, because it has an Update() method, also a SelectCommand(), InsertCommand(), DeleteCommand() and UpdateCommand().
My form doesn't have a SqlDataAdapter. Do I have to create a SqlDataAdapter in code? The constructor wants a SQLString and a connection object. It seems a shame as the table Adapter must already 'know' all this.

Update after a bit of reading: Hmm.. Can of worms.
Reply With Quote
  #13 (permalink)  
Old May 20th, 2008, 10:25 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

I mentioned 'DataAdapter', which is the base class for the SqlDataAdapter.
DataAdapters are designed to be the intermediary between the DataSet and the data within the data store. ADO.NET is designed to be disconnected, so the adapter is required to send the correct commands to the connection based on changes made to the DataSet.

Obviously the process for this may differ between data store technologies (be it XML, SQL, Oracle, OLEDB, whatever), hence the base class and the specialised classes.
All DataAdapter classes implement the IDataAdapter interface (http://tinyurl.com/3l46ca) which has an Fill and Update method (as well as others). Fill will pull data from the DB, Update will post changes back to the DB.

In terms of the TableAdapter, I am unfamiliar with this, I know they introduced these Fx2.0, but I have never used them so my knowledge is limited. However, a look at MSDN (http://tinyurl.com/42pf28) shows that they are not much more than an extension to the DataAdapter class to provide some freedom in Getting/Setting data..

As for the can of worms, data access is a HUGE topic, technologies aside, there are/can be major architectural issues both on the client and server..

I hope this helps.

Rob
http://robzyc.spaces.live.com
Reply With Quote
  #14 (permalink)  
Old May 22nd, 2008, 10:34 AM
Registered User
 
Join Date: May 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There are some big issues here. I have a lot more reading to do before I start designing apps.
I have to choose between SqlDataAdapters and TableAdapters, I have to understand some of the issues with using SQL Server bit fields and front ends if I allow three-state field values, and in general I think I need to buy some textbooks and put more effort in before making a start.
Thanks for the help so far.

Reply With Quote
  #15 (permalink)  
Old May 23rd, 2008, 03:15 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

I always say that "if you are going to get into something, then get into it", dont mess around. Its nice to read about a positive, driven attitude. I know it can be hard doing the reasearch/groundwork and you wanna just roll your sleaves up and code, but it really does pay dividends in the long run since you UNDERSTAND what the code is doing. This for me is a major fundamental, you actually and makes debugging a lot easier! So many people just seem to want the code, copy-and-paste and not give a damn..

If you need anything else then please feel free to ask :)

Rob
http://robzyc.spaces.live.com
Reply With Quote
  #16 (permalink)  
Old May 23rd, 2008, 03:58 AM
Registered User
 
Join Date: May 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I come from an Access programming background so I expect to be able to immediately start implementing solutions once I think I've understood the problem. A lot of what I learnt carries over to the .NET suite, but it's not enough.
SQL Server is a much bigger deal than Jet.
Windows Forms is a bigger deal than VBA.
ADO.NET is a hugely bigger deal than DAO.
I could pick just one of them, but my current employer has the products and only one developer, and I had never touched any of .NET before this. I managed to write an ASP.NET app in about ten months, and thought a Winforms app would be like knocking up an Access solution, given the client-based nature. Parts of it has been but parts of it require that I learn new things.

Can you recommend any books for SQL Server 2005 and ADO.NET, and do you think I should be using WPF instead of WinForms?
Thx


Reply With Quote
  #17 (permalink)  
Old May 23rd, 2008, 04:19 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

I think you may be better off getting an "all-round" book since you have clearly said you have a lot to pick up.

As for book recommendations, I often find reading a few MS cert training books could be useful since they cover most the aspects you need to develop applications. You can obviously then skip areas you may not need (such as globalisation), the benefit of these are they cover these areas in exam-level detail, which can be really important for your understanding of "whats going on". I highly recommend the books by Kalani (Exam Cram)..

As for specific SQL Server/ADO.NET Books I dont really have any recommendations since I have no specialised books myself (tend to google anything I need to know since I have base knowledge).

And Winforms/WPF? Well, they are two very different technologies. I personally would recommend WinForms over WPF purely based on the fact most jobs will be working with that.. This is just my personal opinion though.

Rob
http://robzyc.spaces.live.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in using Browser in Winforms jay69 C# 0 December 5th, 2006 05:49 AM
Posting Data to a Website using Winforms c# jay69 C# 1 December 2nd, 2006 06:33 AM
Debugging Winforms gaghazoul Visual Studio 2005 0 May 18th, 2006 01:43 PM
Deleting rows in Winforms Datagrid livehed General .NET 0 May 4th, 2006 01:23 AM
autocomplete combo in vb.net winforms imsuneeta General .NET 1 January 25th, 2005 07:00 AM



All times are GMT -4. The time now is 12:38 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.