Use a cursor from the page

i want to call a cursor froom the aspx.cs page

Please give a demo of corsor and how I will use it from the PAGE of ASP.NET 2.0 (CODE BEHIND)
Who is Participating?
Om PrakashConnect With a Mentor Commented:
Instead of cursor you can query database and loop through in c#
 string mySelectQuery = "SELECT OrderID, CustomerID FROM Orders";
    SqlConnection myConnection = new SqlConnection(myConnString);
    SqlCommand myCommand = new SqlCommand(mySelectQuery,myConnection);
    SqlDataReader myReader;
    myReader = myCommand.ExecuteReader();
    // Always call Read before accessing data.
    while (myReader.Read()) {
       Console.WriteLine(myReader.GetInt32(0) + ", " + myReader.GetString(1));
    // always call Close when done reading.
    // Close the connection when done with it.

Open in new window

darshan_derasariConnect With a Mentor Commented:
Look at the sample code provided for cursor in below links. You can define your necessary code for cursor in stored procedure and call it from the code behind of your web page.

All Courses

From novice to tech pro — start learning today.