Sorted Day , Month , Year in DataGridView VB.NET
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I tried to sort data in DataGridView it's not work because function is sort specifically day. Not sort month and year.
sql = "SELECT * FROM data_timein WHERE (CONVERT(datetime,day_in,103) >= '" & date1 & "') AND (CONVERT(datetime, day_in,103) <= '" & date2 & "')"
DataGridView1.DataSource = cmd_ExcuteDataTable()
DataGridView1.Sort(DataGridView1.Columns(2),System.ComponentModel.ListSortDirection.Ascending)
vb.net
add a comment |
I tried to sort data in DataGridView it's not work because function is sort specifically day. Not sort month and year.
sql = "SELECT * FROM data_timein WHERE (CONVERT(datetime,day_in,103) >= '" & date1 & "') AND (CONVERT(datetime, day_in,103) <= '" & date2 & "')"
DataGridView1.DataSource = cmd_ExcuteDataTable()
DataGridView1.Sort(DataGridView1.Columns(2),System.ComponentModel.ListSortDirection.Ascending)
vb.net
What is the data type of yourday_in
column?
– jmcilhinney
Jan 3 at 2:45
Data type day_in in mysql is varchar.
– allarm
Jan 3 at 4:26
Why would you store dates as text in the first place? The fact that you can't sort the data chronologically is a perfect example of why you should store dates as dates, not text. Is that something that is within your control? If so, change it. If not, you're going to have to convert the data somewhere to another form in order to sort chronologically.
– jmcilhinney
Jan 3 at 5:03
Thank you for your advice. I understand and i will apply for my project. I'm sorry about language usage I'm not good English. I'm from Thailand.
– allarm
Jan 3 at 6:35
@allarm Welcome to Stack Overflow. Your English in fine. Your question was understood. Glad to know you are from Thailand. You can add your location to your profile.
– Mary
Jan 3 at 8:18
add a comment |
I tried to sort data in DataGridView it's not work because function is sort specifically day. Not sort month and year.
sql = "SELECT * FROM data_timein WHERE (CONVERT(datetime,day_in,103) >= '" & date1 & "') AND (CONVERT(datetime, day_in,103) <= '" & date2 & "')"
DataGridView1.DataSource = cmd_ExcuteDataTable()
DataGridView1.Sort(DataGridView1.Columns(2),System.ComponentModel.ListSortDirection.Ascending)
vb.net
I tried to sort data in DataGridView it's not work because function is sort specifically day. Not sort month and year.
sql = "SELECT * FROM data_timein WHERE (CONVERT(datetime,day_in,103) >= '" & date1 & "') AND (CONVERT(datetime, day_in,103) <= '" & date2 & "')"
DataGridView1.DataSource = cmd_ExcuteDataTable()
DataGridView1.Sort(DataGridView1.Columns(2),System.ComponentModel.ListSortDirection.Ascending)
vb.net
vb.net
edited Jan 3 at 2:44
jmcilhinney
26.5k32033
26.5k32033
asked Jan 3 at 2:39
allarmallarm
1
1
What is the data type of yourday_in
column?
– jmcilhinney
Jan 3 at 2:45
Data type day_in in mysql is varchar.
– allarm
Jan 3 at 4:26
Why would you store dates as text in the first place? The fact that you can't sort the data chronologically is a perfect example of why you should store dates as dates, not text. Is that something that is within your control? If so, change it. If not, you're going to have to convert the data somewhere to another form in order to sort chronologically.
– jmcilhinney
Jan 3 at 5:03
Thank you for your advice. I understand and i will apply for my project. I'm sorry about language usage I'm not good English. I'm from Thailand.
– allarm
Jan 3 at 6:35
@allarm Welcome to Stack Overflow. Your English in fine. Your question was understood. Glad to know you are from Thailand. You can add your location to your profile.
– Mary
Jan 3 at 8:18
add a comment |
What is the data type of yourday_in
column?
– jmcilhinney
Jan 3 at 2:45
Data type day_in in mysql is varchar.
– allarm
Jan 3 at 4:26
Why would you store dates as text in the first place? The fact that you can't sort the data chronologically is a perfect example of why you should store dates as dates, not text. Is that something that is within your control? If so, change it. If not, you're going to have to convert the data somewhere to another form in order to sort chronologically.
– jmcilhinney
Jan 3 at 5:03
Thank you for your advice. I understand and i will apply for my project. I'm sorry about language usage I'm not good English. I'm from Thailand.
– allarm
Jan 3 at 6:35
@allarm Welcome to Stack Overflow. Your English in fine. Your question was understood. Glad to know you are from Thailand. You can add your location to your profile.
– Mary
Jan 3 at 8:18
What is the data type of your
day_in
column?– jmcilhinney
Jan 3 at 2:45
What is the data type of your
day_in
column?– jmcilhinney
Jan 3 at 2:45
Data type day_in in mysql is varchar.
– allarm
Jan 3 at 4:26
Data type day_in in mysql is varchar.
– allarm
Jan 3 at 4:26
Why would you store dates as text in the first place? The fact that you can't sort the data chronologically is a perfect example of why you should store dates as dates, not text. Is that something that is within your control? If so, change it. If not, you're going to have to convert the data somewhere to another form in order to sort chronologically.
– jmcilhinney
Jan 3 at 5:03
Why would you store dates as text in the first place? The fact that you can't sort the data chronologically is a perfect example of why you should store dates as dates, not text. Is that something that is within your control? If so, change it. If not, you're going to have to convert the data somewhere to another form in order to sort chronologically.
– jmcilhinney
Jan 3 at 5:03
Thank you for your advice. I understand and i will apply for my project. I'm sorry about language usage I'm not good English. I'm from Thailand.
– allarm
Jan 3 at 6:35
Thank you for your advice. I understand and i will apply for my project. I'm sorry about language usage I'm not good English. I'm from Thailand.
– allarm
Jan 3 at 6:35
@allarm Welcome to Stack Overflow. Your English in fine. Your question was understood. Glad to know you are from Thailand. You can add your location to your profile.
– Mary
Jan 3 at 8:18
@allarm Welcome to Stack Overflow. Your English in fine. Your question was understood. Glad to know you are from Thailand. You can add your location to your profile.
– Mary
Jan 3 at 8:18
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54015646%2fsorted-day-month-year-in-datagridview-vb-net%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54015646%2fsorted-day-month-year-in-datagridview-vb-net%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What is the data type of your
day_in
column?– jmcilhinney
Jan 3 at 2:45
Data type day_in in mysql is varchar.
– allarm
Jan 3 at 4:26
Why would you store dates as text in the first place? The fact that you can't sort the data chronologically is a perfect example of why you should store dates as dates, not text. Is that something that is within your control? If so, change it. If not, you're going to have to convert the data somewhere to another form in order to sort chronologically.
– jmcilhinney
Jan 3 at 5:03
Thank you for your advice. I understand and i will apply for my project. I'm sorry about language usage I'm not good English. I'm from Thailand.
– allarm
Jan 3 at 6:35
@allarm Welcome to Stack Overflow. Your English in fine. Your question was understood. Glad to know you are from Thailand. You can add your location to your profile.
– Mary
Jan 3 at 8:18