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.
Login to rate this answer.
Copy/Paste the code and study it.
For me it works.
Code
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Data;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
SqlConnection con = new SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=YourDatabase;Integrated Security=True;");
try
{
con.Open();
SqlCommand cmd = new SqlCommand("SELECT * FROM Table1", con);
SqlDataReader reader = cmd.ExecuteReader();
while(reader.Read())
{
Console.Write(reader[0]);
Console.WriteLine(reader[1]);
}
}catch(Exception e)
{
Console.WriteLine(e);
}
}
}
}
Login to rate this answer.
vikramreddy
Answered On : 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
Login to rate this answer.