Click here to Skip to main content
15,920,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
any body help about this.

thanks,
Posted
Comments
Wendelius 11-Apr-11 13:03pm    
Are you asking about the data added to a database by a user or do you want information about the database users (from security information)

try this link

Click[^]
 
Share this answer
 
SQL
SqlDataReader provides a means of reading a forward-only stream of data records from a SQL Server data source. For more interactive operations such as scrolling, filtering, navigating, and remoting, use the DataSet.
The example creates a SqlConnection to the Northwind database. The SqlCommand selecting items from the employee table is then executed using the SqlCommand ExecuteReader method. The results of this command are passed to the SqlDataReader.



SqlDataReader myDataReader = null;

SqlConnection mySqlConnection = new SqlConnection("server=(local)\SQLExpress;Integrated Security=SSPI;database=northwind");
SqlCommand mySqlCommand = new SqlCommand("SELECT EmployeeID, LastName, FirstName, Title, ReportsTo FROM Employees", mySqlConnection);
...
mySqlConnection.Open();
myDataReader = mySqlCommand.ExecuteReader(CommandBehavior.CloseConnection);
SQL
The example reads through the data using the SqlDataReader Read method and writing the data elements out to the console.

    while (myDataReader.Read())
    {
      Console.Write(myDataReader.GetInt32(0) + "\t");
      Console.Write(myDataReader.GetString(2) + " " + myDataReader.GetString(1) + "\t");
      Console.Write(myDataReader.GetString(3) + "\t");
      if (myDataReader.IsDBNull(4))
        Console.Write("N/A\n");
      else
        Console.Write(myDataReader.GetInt32(4) + "\n");
    }


VB
Finally, the example closes the SqlDataReader, then the SqlConnection.

    // Always call Close when done reading.
    myDataReader.Close();
    // Close the connection when done with it.
    mySqlConnection.Close();


Or You can do it by alternate way click

[Here]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900