469,138 Members | 1,383 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,138 developers. It's quick & easy.

Getting last value and increasing it by one

2
Hello,
My name is Tim and I am new here so i would just like to start of with saying hi to everyone!

the problem i have is i am using asp.net and SQL and I want to get the last value of the called vidid and increase it by one.

I have found this code
SELECT MAX(vidid) + 1
FROM dbo.Videos

I am using dreamweaver 8 and I use the test button and it submits it and comes up with the value i want.

I then press ok and go to bindings to get the value and there are no binding so i wrote the code in my self and it does not display anything not even a error msg.

I have also tryed this code

SELECT vidid + 1
FROM dbo.Videos
ORDER BY vidid DESC

This does not work aswell but if i remove the + 1 then i see that last value.

Any ideas ?? like alternate code

Thanks

Tim
Jul 17 '07 #1
3 1168
DonlonP
25
Hello,
My name is Tim and I am new here so i would just like to start of with saying hi to everyone!

the problem i have is i am using asp.net and SQL and I want to get the last value of the called vidid and increase it by one.

I have found this code
SELECT MAX(vidid) + 1
FROM dbo.Videos

I am using dreamweaver 8 and I use the test button and it submits it and comes up with the value i want.

I then press ok and go to bindings to get the value and there are no binding so i wrote the code in my self and it does not display anything not even a error msg.

I have also tryed this code

SELECT vidid + 1
FROM dbo.Videos
ORDER BY vidid DESC

This does not work aswell but if i remove the + 1 then i see that last value.

Any ideas ?? like alternate code

Thanks

Tim
Hi Tim,

I'm not familiar with dreamweaver but your original SQL query should work. If it returns a value in query analyser then make sure you're binding it correctly and also check your database connection string in .net.
Jul 22 '07 #2
Renar
2
Hi Tim,

I'm not familiar with dreamweaver but your original SQL query should work. If it returns a value in query analyser then make sure you're binding it correctly and also check your database connection string in .net.
hello thanks for responding...
i used a sqlcommand instead and its working now but thanks anyway.
Jul 25 '07 #3
hi
if you use this value for inserting new record in a multi user application your solution may not work.check it.
Jul 25 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Carlos San Miguel | last post: by
reply views Thread by Jim | last post: by
reply views Thread by Jim | last post: by
4 posts views Thread by Gary | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.