Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6759961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:00:46+00:00 2026-05-26T14:00:46+00:00

I´ve got a special problem, that first seems very easy but I don´t know

  • 0

I´ve got a special problem, that first seems very easy but I don´t know any solution.
At the moment I programm a C#-WPF-Application that makes it possible to save bookings.
A booking also has a date, which I take from a calender.
I save the booking to my Sql-Express Database and the value of a date is “DD.MM.YYYY”, the datatype is date.

Now, I load the data into a datagrid in my application:

    public DataSet SaveDataToDataSet(DataSet dataset)
    {

        string connectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Users\\Harald\\Desktop\\Farmer´s Calc\\Programmierung\\WPF\\Finanz_WPF\\Finanz_WPF\\FarmersCalc.mdf;Integrated Security=True;User Instance=True";
        string query = "select bezeichnung 'Bezeichnung', einausgaben 'Einnahmen-Ausgaben',  kostenstelle 'Kostenstelle',  datum 'Buchungsdatum', betrag 'Betrag', details 'Details' from Buchung";
        using (SqlConnection connection =
            new SqlConnection(connectionString))
        {
            SqlDataAdapter adapter = new SqlDataAdapter();
            adapter.SelectCommand = new SqlCommand(
                query, connection);

            adapter.Fill(dataset);
            return dataset;

        }
    }

Strangely, the date column in the DataGrid has the format “DD.MM.YYYY HH:MM:SS”, but I only want “DD.MM.YYYY”!
What I need to say is, that I don´t have Columns defined, I make it with AutoGenerateColumns=true.
Does anybody know a solution for that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:00:46+00:00Added an answer on May 26, 2026 at 2:00 pm

    The “date” Sql type ends up being a DateTime in your dataset, which is why you’re getting the time as well. You’ll need to define columns and specify formatting on your datagrid.

    EDIT: I was mistaken about not being able to format this when auto generating columns. As the other answer here mentions, this question: Need to format dates in dynamically built WPF DataGrid addresses some ways to accomplish this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got a weird problem. I have a program that (does many things but
I've got a huge problem. I made a special ID for the things in
My problem is, that I have got a TabActivity, which has 4 Tabs right
I've got a .jsp file that is working fine. It's maybe a bit special
My problem is simple... or may be not. I've got a table that contains
I know that many people, at a first glance of the question, may immediately
So I got a problem that I can't wrap my mind around. I'm creating
I've got a problem with XMLHttpRequest. I have a that has a onChange event
am using jquery tablesorter plugin and in my country column i got special characters
I've got a select with two 'special' options, a bit like this: <select> <option

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.