How can retrieve the data from database? what is cell in dot frameworks?

Showing Answers 1 - 9 of 9 Answers

We can retrieve data from database using ADO.NET we can use connection string in which data reader data adapter can be used. Data set are used for retrieve bulk of data.
We can also use data binder which binds the data.
The cell in .Net is used for changing events.

  Was this answer useful?  Yes

mike19

  • Sep 22nd, 2011
 

Copy/Paste the code and study it.

For me it works.

Code
  1. using System;

  2. using System.Collections.Generic;

  3. using System.Text;

  4. using System.Data.SqlClient;

  5. using System.Data;

  6.  

  7. namespace ConsoleApplication2

  8. {

  9.     class Program

  10.     {

  11.         static void Main(string[] args)

  12.         {

  13.             SqlConnection con = new SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=YourDatabase;Integrated Security=True;");

  14.             try

  15.             {

  16.             con.Open();

  17.             SqlCommand cmd = new SqlCommand("SELECT * FROM Table1", con);

  18.             SqlDataReader reader = cmd.ExecuteReader();

  19.                 while(reader.Read())

  20.                 {

  21.                     Console.Write(reader[0]);

  22.                     Console.WriteLine(reader[1]);

  23.                 }

  24.        

  25.            

  26.             }catch(Exception e)

  27.             {

  28.                 Console.WriteLine(e);

  29.             }

  30.            

  31.             }

  32.     }

  33. }

  34.  

  Was this answer useful?  Yes

vikramreddy

  • Feb 15th, 2012
 

FOR CONNECT

1.establish the connection between the database

2.send the request(execute the command)

3.get the data form data base

4.close connection

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions