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 8155581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:42:38+00:00 2026-06-06T16:42:38+00:00

I have a gridview and a SqlDataSource . In the SqlDataSource ‘s update statement

  • 0

I have a gridview and a SqlDataSource.

In the SqlDataSource‘s update statement I’m trying to convert the string of the column to datetime with this:

Date = Convert(DateTime, @Date, 104) 
//this converts the string to mm.dd.yyyy .

I can’t find the code for mm.dd.yyyy hh:mm .

  • 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-06-06T16:42:40+00:00Added an answer on June 6, 2026 at 4:42 pm

    Your questions states you are using a GridView and a DataSource.

    I’m assuming your source data is in a DateTime format in SQL Server.
    If so, leave it in that format, otherwise, cast it as a DateTime when returning it.

    Do NOT try converting it into a string on the SQL Server end or run a pass over your DataTable and convert it to a string using C#. That is the wrong approach to this.

    All you need to do is set the DataFormatString on your GridView’s BoundField column like so:

    BoundField bf = new BoundField();
    bf.DataField = "xxxxx";//The field from your DataSource you are binding to.
    bf.HeaderText = "yyyyy";//The column header text of your GridView.
    bf.DataFormatString = "{0:MM.dd.yyyy hh:mm}";
    gv.Columns.Add(bf);//Add the column to your GridView.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to conditionally call update statement on sqldatasource. I have a gridview and
I have a GridView and SqlDataSource , I have a column type: DateTime .
I have Gridview like this. Here is my last column Gridview code; <EditItemTemplate> <asp:TextBox
I have a Gridview like this picture. Easyly in my last column, i keep
I have a gridview connected to database using sqldatasource. There is a datetime field
I have a gridview and sqldatasource. In tabledefinition the default format for date is
I have a gridview and sqldatasource. I'm trying to insert new records in database
I have a gridview and sqldatasource. The default header text for each column is
I have a gridview and sqldatasource. I have a templatefield column and below the
I have asp:GridView displaying client requests using asp:SqlDataSource . I want to limit displayed

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.