Results 1 to 2 of 2

Thread: Help with my query string

Threaded View

  1. #1

    Thread Starter
    Fanatic Member daimous's Avatar
    Join Date
    Aug 2005
    Posts
    657

    Help with my query string

    hi guys! i have a code below that query something from my database
    Code:
    string SqlConnStr = Properties.Settings.Default.MyConnString;
    sqlConn = new SqlConnection(SqlConnStr);
    sqlConn.Open();
    string qryStr = "Select Max(number) from docs_ref";
    SqlCommand SqlCmd = new SqlCommand(qryStr, sqlConn);
    object result = SqlCmd.ExecuteScalar();
    SqlCmd.Connection.Close();
    sqlConn.Close();
    but how can I check if it does return any value or not and if it does how can i retrieve the value? thanks.
    Last edited by daimous; Sep 17th, 2006 at 09:56 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width