Sunday, February 19, 2012

How to get id number from sql

i am an asp programer trying to program in aspx c#
i have a litle problem geting the id number from my sql db and put it into an intiger

what i am doing is that i am trying to make the picture have the same name as the id number in the db

String sql = "SELECT id ";
sql += " FROM PictureLibrary";
sql += " ORDER BY id desc";

int pictureNR = ??You need to use ExecuteScalar Method

For more info on this see below links, they will helps you

http://authors.aspalliance.com/aspxtreme/sys/Data/SqlClient/SqlCommandClassExecuteScalar.aspx

Execute Scalar on MSDN

Hope these helps!|||how can i see if the record is EOF

No comments:

Post a Comment