Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I enter a new record into my database I would like to reorder the dataset so it shows in it's proper position in the set. Presently it stays at the end of the dataset until I close the program and reopen it.

What I have tried:

Haven't tried anything yer, been looking for a solution for awhile.
Posted
Updated 27-Mar-18 7:59am
Comments
Maciej Los 27-Mar-18 15:26pm    
An order of data in dataset depends on many factors, such as indexes...

1 solution

Quote:
Presently it stays at the end of the dataset until I close the program and reopen it.

From what you say, the database sort the new row.
you need to clear the dataset and reload it after insert.
[Update]
Quote:
I have another question if I may. I have built a DataGridView and when I click on a specific cell it opens another window and supposed to display the column name and the data in the cell. The window opens, but in order to get the data to show I have to press enter. I have been working on this for a while also but can’t figure out why the information won’t show when the window opens. Here is the code After the cell.click. Any suggestions?

Your code do not behave the way you expect, and you don't understand why !

There is an almost universal solution: Run your code on debugger step by step, inspect variables.
The debugger is here to show you what your code is doing and your task is to compare with what it should do.
There is no magic in the debugger, it don't know what your is supposed to do, it don't find bugs, it just help you to by showing you what is going on. When the code don't do what is expected, you are close to a bug.
To see what your code is doing: Just set a breakpoint and see your code performing, the debugger allow you to execute lines 1 by 1 and to inspect variables as it execute.

The downside of this solution:
- It is a DIY, you are the one tracking the problem and finding its roots, which lead to the solution.
The upside of this solution:
- It is also a great learning tool because it show you reality and you can see which expectation match reality.

secondary effects
- Your will be proud of finding bugs yourself.
- Your learning skills will improve.

You should find pretty quickly what is wrong.

Debugger - Wikipedia, the free encyclopedia[^]

Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]
Basic Debugging with Visual Studio 2010 - YouTube[^]
Visual Basic / Visual Studio Video Tutorial - Basic Debugging - YouTube[^]
Visual Basic .NET programming for Beginners - Breakpoints and Debugging Tools[^]
The debugger is here to only show you what your code is doing and your task is to compare with what it should do.
 
Share this answer
 
v2
Comments
Member 10376725 27-Mar-18 15:44pm    
Thanks ppolymorphe, worked as desired.
Patrice T 27-Mar-18 15:46pm    
You're welcome.
Member 10376725 27-Mar-18 16:03pm    
I have another question if I may. I have built a DataGridView and when I click on a specific cell it opens another window and supposed to display the column name and the data in the cell. The window opens, but in order to get the data to show I have to press enter. I have been working on this for a while also but can’t figure out why the information won’t show when the window opens. Here is the code After the cell.click. Any suggestions?

Private Sub GrdViewMovies_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles grdViewMovies.CellContentClick
Dim value As Object = grdViewMovies.Rows(e.RowIndex).Cells(e.ColumnIndex).Value
Dim colNumb As String = grdViewMovies.CurrentCell.ColumnIndex.ToString

' Make sure only information in columns 0, 1, 2 or 4 can be displayed.

If colNumb = "0" Or colNumb = "1" Or colNumb = "2" Or colNumb = "4" Then
displayText = CType(value, String)
colName = grdViewMovies.Columns(e.ColumnIndex).Name
Using sayitForm As New Information
sayitForm.ShowDialog(Me)
End Using
End If
End Sub

Public Class INFORMATION

Private Sub TxtSayIt_TextChanged(Sender As Object, e As EventArgs) Handles txtSayIt.TextChanged
txtColumnBox.Text = SQLForm.colName
txtSayIt.Text = SQLForm.displayText
End Sub
End Class
Patrice T 27-Mar-18 16:10pm    
Use Improve question to update your question.
So that everyone can pay attention to this information.
Or open a new question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900