data appear as date in a datetimepicker?

g3jimha

Member
Joined
Jun 23, 2011
Messages
8
Programming Experience
1-3
was just wondering if it was possible to add data retrieved from an sqlserver database to appear as that date in a date time picker?
thanks, Jim :)
 
In Data Sources window click the table and in dropdown select 'Details' rather than 'DataGridView'. When you drag the table to a form all Date type columns are automatically represented as and bound to DateTimePicker controls.
 
Thanks for the feedback but I'm not using the datasource im connecting to the database using;
con.ConnectionString ="Data Source=(local)"
con.Open()
I'm not using the data source because I think I set up my sql server wrongly and it wont connect, but it seems to connect using that :S
is there any other way round this?
thanks, Jim
etc
 
All the data wizards in VS does is write the code for you. If you don't want that you can of course write the code yourself. Look up ADO.Net at MSDN Library and you can learn everything about the classes involved. I would go to greater lengths though, to learn and make use of the tools VS provides, to avoid writing unnecessary code and to start learning ADO.Net. Even without the connection wizard and strongly typed dataset there is lots that can be set up manually in designer, but that requires that you already know the components and their relationship and how they are configured, which is something you get for free and can learn from the regular way of setting up data access.
 
Back
Top