Design:-
- Create a new WindowsForms Application
- Create a DataGridView on it
- Generate EventHandler for the Default Event of the form i.e.,Load
- Goto Source & write the Following Code
using
System.Data.SqlClient;
namespace FormNPQInsert
{
public partial
class FormDG1
: Form
{
SqlConnection Con = new SqlConnection("Server=.;User
Id=sa;Password=Admin123;DataBase=Employee");
SqlDataAdapter Da;
public FormDG1()
{
InitializeComponent();
}
private void
FormDG1_Load(object sender, EventArgs e)
{
Da=new
SqlDataAdapter("Select
* from EmpDetails",Con);
DataSet
Ds = new DataSet();
Da.Fill(Ds,"Table1");
DGVSample.DataSource =
Stables[0];
}
}
}
|
No comments:
Post a Comment