IRC Networks
Irc Logs Stats
Start date: 2007-09-27 02:48:27
Last update: 2008-10-24 20:19:38
Channels: 41
Logged Lines: 6230436
Size: 1822.65 MB
Powered by
Channel Info
Network: freenodeChannel: #csharp |
Search in www.irclog.org
Log from #csharp at freenode 2006-05-19
[18:11]<dzdyzzz-wjzc>antonis, go google
[18:12]<dzdyzzz-wjzc>you'll find plenty of samples
[18:16]<svzz[wjzc]>ADO.NET 2.0 : i'm not totally sure how to fill a Combobox out of a Command without using a DataAdapter : cmbID_Titre.DataSource = CMD.ExecuteReader(); <- this throws an exception : {"Complex DataBinding accepts as a data source either an IList or an IListSource."}
[18:16]<rjjgwq>antonis`: http://www.codeproject.com/aspnet/adodotnet.asp
[18:20]<dzdyzzz-wjzc>StaZ[work] it's either data binding with an adaptor
[18:20]<dzdyzzz-wjzc>or
[18:20]<dzdyzzz-wjzc>you foreach over the records back from cmd.ExecuteReader(); and cmbID_Titre.Items.Add(...); each one
[18:24]<azyfm>ExecuteReader() isn't foreachable, is it?
[18:24]<azyfm>a DataReader, I mean
[18:25]<svzz[wjzc]>damieng okay, in case i want binding i aldready Have a DataAdapter for my Form, which has a Select and an Update command set, can i use this adater to fill my 6 comboboxes or i have to create another adapter
[18:25]<azyfm>TableAdapter?
[18:26]<azyfm>just add a new Query to it
[18:27]<svzz[wjzc]>hm i don't see where the DataAdapter.Add() method is
[18:27]<azyfm>I meant in the designer
[18:27]<svzz[wjzc]>no designer, all coded
[18:27]<azyfm>meh
[18:28]<svzz[wjzc]>my connection itself has to be coded as the IDE won't let me use a simple connection string as a datasource for some reason
[18:28]<azyfm>why would a connection string be a datasource?
[18:28]<svzz[wjzc]>i connect to an instance of SQL Server
[18:28]<svzz[wjzc]>so i can't reference the .mdf
[18:28]<azyfm>that's what I'm doing too
[18:29]<azyfm>Data->Add New Datasource
[18:29]<azyfm>give it the connection string
[18:29]<azyfm>pick the tables/views you want
[18:29]<azyfm>voila, instant ORM
[18:29]<azyfm>(sort of)
[18:29]<svzz[wjzc]>where do you write the connection string
[18:29]<azyfm>in the wizard
[18:30]<svzz[wjzc]>i click Add new Datasource, it opens teh wizard with Database, Web Server and Object
[18:30]<svzz[wjzc]>i choose database
[18:30]<azyfm>pick database
[18:30]<azyfm>then New Connection...
[18:30]<svzz[wjzc]>then all i get is a Combobox with a button new connection
[18:30]<svzz[wjzc]>the part where itS' written "connection string" is not enabled
[18:30]<azyfm>it's meant to be read only
[18:31]<svzz[wjzc]>ok...
[18:31]<azyfm>do the New Connection thing
[18:31]<svzz[wjzc]>i did
[18:31]<azyfm>pick the server
[18:31]<svzz[wjzc]>where?
[18:31]<azyfm>in the Server name dropdown
[18:31]<svzz[wjzc]>ain't got that
[18:31]<azyfm>What ain you got, then?
[18:32]<svzz[wjzc]>let me screenshot it
[18:33]<svzz[wjzc]>http://img481.imageshack.us/my.php?image=datasource2ej.jpg
[18:34]<azyfm>Press the Change... button, then pick Microsoft SQL Server from the list
[18:35]<svzz[wjzc]>in the change i have 2 choices : Access Database file and SQL Server Database File
[18:35]<azyfm>huh
[18:36]<svzz[wjzc]>http://img481.imageshack.us/my.php?image=datasource6bh.jpg
[18:36]<azyfm>that's pretty weird
[18:37]<azyfm>I have 6 choices + <other> in that dialog
[18:37]<svzz[wjzc]>could it be the Express edition of C# that doesn't support it?
[18:37]<azyfm>that'd be weird, I think
[18:37]<22ppzyvj>is there a way to get the 'value' of an enum?
[18:38]<azyfm>yes
[18:38]<azyfm>cast it to int
[18:38]<22ppzyvj>danke
[18:38]<azyfm>or whatever the base type for the enum is
[18:38]<svzz[wjzc]>Arild well.. i spent 2 hours trying to connect it via the IDE before making an Hardcoded connection, in any case...
[18:39]<azyfm>hm, couldn't you use the MDF thingy to have it generate the table adapters and the typed datasets for you, then change the connection string afterwards?
[18:40]<svzz[wjzc]>i can't reach teh MDF from my workstation it's on the server
[18:40]<svzz[wjzc]>what would be better for the "system" it self, a Combobox.datasoure bound to a datatable or a reader that .Add ?
[18:40]<svzz[wjzc]>caus if the .add system is quicker i'll just leave the binding
[18:40]<svzz[wjzc]>:P
[18:41]<azyfm>it's faster
[18:41]<azyfm>not sure by how much
[18:41]<azyfm>but datasets are heavy
[18:41]<azyfm>and a DataAdapter uses a DataReader as well
[18:41]<svzz[wjzc]>yeah well someone told me yesterday i could obtain a datatable out of an sqlCommand without using the DataAdapter, so i guess it was skipping the dataset step too
[18:42]<vjvrfd_fjsv>in 2.0 yes
[18:42]<azyfm>how?
[18:42]<svzz[wjzc]>totaly_lost oh?
[18:42]<vjvrfd_fjsv>there is no more dependency datatable <> dataset
[18:42]<svzz[wjzc]>that was my original question :P
[18:42]<vjvrfd_fjsv>why not use through bindingsource?
[18:43]<vjvrfd_fjsv>or is speed so very important here?
[18:43]<azyfm>right, DataTable.Load(dataReader)
[18:43]<azyfm>BindingSource or not, the data still has to come from somewhere
[18:44]<vjvrfd_fjsv>:)
[18:44]<svzz[wjzc]>my comboboc does not have a BindingSource propety
[18:44]<svzz[wjzc]>it has DataBindings but that's another thing completely
[18:44]<azyfm>yourComboBox.DataSource = someBindingSource;
[18:44]<vjvrfd_fjsv>yes
[18:44]<azyfm>someBindingSource.DataSource = something;
[18:44]<svzz[wjzc]>oh that ok
[18:45]<vjvrfd_fjsv>also ValueMember and Display Member
[18:45]<vjvrfd_fjsv>don't forget to set them
[18:45]<svzz[wjzc]>yeah all is set it's just the datasource
[18:47]<svzz[wjzc]>okay so i can use a BindingSource... okay i'll check if i can get that off a Command
[18:47]<azyfm>"So on Tuesday Jonathan Schwartz and Rich Green promised that sometime soon, their 40-year old daughter Java will be allowed to quit her job in the family business and begin a pro golfing career. Frankly, it's a little late for that."
[18:47]<azyfm>a BindingSource is just an intermediary
[18:47]<azyfm>you still need either a DataTable, DataSet or an object collection behind it
[18:47]<vjvrfd_fjsv>if you want to get deeper in binding sources, etc. there is a good book about it by Brian Noyes
[18:49]<svzz[wjzc]>totaly_lost hm thanks but i aldready ordered a book, for now... from Andrew Troelsen, someone suggested me... was it you Arild ?
[18:49]<azyfm>doubt it
[18:50]<svzz[wjzc]>i tend to forget who i speak with :( and i don't log here at work
[18:50]<azyfm>I've never really read a "C# book"
[18:50]<svzz[wjzc]>okay it's not you, the guy said he had tons of books
[18:50]<azyfm>quite a few .NET books, sure
[18:50]<vjvrfd_fjsv>StaZ[home] eys, that one is also a very very good book







