|
-
Feb 27th, 2007, 07:24 AM
#1
Thread Starter
Hyperactive Member
Datagrid Not Correct
Hello!
I hope i posted the Thread correct!
Something weird is happening in my project. I save 50 pictures with some characteristics(Name, Size, Width, Height.....) in fields in database and all is working fine. Then when i delete one or two or three pictures still everything is fine. The problem comes when after deleting these pictures i save others into the database. When i save them i see in the datagrid that they are saved in the end(everyone in a new record). When i'm leaving this form and go to another that also has a datagrid the order of the picture has changed.
I will try to show it to you!
Pictures in database according to id:
Step1
1->Deleting
2
3
4
5
6
7
8
9
10
After deleting.
2
3
4
5
6
7
8
9
10
After inserting 4 new pictures.
2
3
4
5
6
7
8
9
10
11
12
13
14
Then going to another form. I get this in the datagrid:
2
3
4
5
6
11
12
7
8
9
10
13
14
Whu is that happening? Any ideas? the order of the pictures is ok in the database but in the DataGrid in all forms i get a wrong order!
When i go to another form i use this code:
Code:
MainForm.Show
Form2.Hide
Unload Form2-> Maybe this is wrong?
Thank's!
-
Feb 27th, 2007, 08:56 AM
#2
New Member
Re: Datagrid Not Correct
You can try:
Select * from <tablename> order by id
then
datagrid1.Refresh
good luck!
-
Feb 27th, 2007, 09:02 AM
#3
Hyperactive Member
Re: Datagrid Not Correct
put a order by on your select query
select * from table1 order by id
is id a integer? if it is a char the arrangement willbe
1
11
12
13
14
2
3
4
5
6
7
8
9
if you have a problem face  it
but what if your face  is your problem
how can you face  it 
-
Feb 27th, 2007, 09:54 AM
#4
Re: Datagrid Not Correct
Duplicate threads have been merged.
We ask that you do not double post the same question in different sections even though the question could apply to more than one section.
Thanks.
-
Feb 27th, 2007, 10:00 AM
#5
Thread Starter
Hyperactive Member
Re: Datagrid Not Correct
Good Idea. I will put the ORDER BY Id ASC in every adodc that i load in all forms!
Let's see what happens!
-
Feb 27th, 2007, 12:49 PM
#6
Re: Datagrid Not Correct
Better yet, delete the ADODC components and use ADO code to interface to databases.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|