Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Problem adding new records

Author  Topic 

RLETD
Starting Member

4 Posts

Posted - 2011-05-05 : 02:09:24
I don't know if this is the right place to put this but I didn't find any other suitable forum.

I have a problem when adding a new record (row) in a table. It appears on row 1 instead of the bottom row (266). It doesn't make a difference if I add it from my vb.net app or through management studio. Does anyone know this problem and is there a solution?

Many thanks

Kind Regards,

René

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-05-05 : 02:18:36
don't worry about that. That is just how the Management Studio display the record to you.

Yes. It makes no different if you add the record via your application or the Management Studio


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

RLETD
Starting Member

4 Posts

Posted - 2011-05-05 : 02:37:07
Thanks for your quick reply.
My vb app reads the table from the top and gets the first row with Id=266 but it needs to be Id=1. It was working fine until now. I have tried sorting the table but that didn't help. Any ideas?


Kind Regards,

René
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-05-05 : 02:42:12
you have a Id column in the table ?

add a ORDER BY Id to your query


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

RLETD
Starting Member

4 Posts

Posted - 2011-05-05 : 02:49:23
The Id column is not autonumber. Before writing the new record I retrieve the last Id and add 1. Do I need to add ORDER BY ID before writing or before retrieving?

Kind Regards,

René
Go to Top of Page

RLETD
Starting Member

4 Posts

Posted - 2011-05-05 : 02:55:03
Silly question that was. I figured it out. Thanks for your input.

Kind Regards,

René
Go to Top of Page
   

- Advertisement -