To fill table into dataset in asp.net.

Jitendrasoft09
Posted by Jitendrasoft09 under C# category on | Points: 40 | Views : 649
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;

class jkExample {

static void Main(string[] args) {


ConnectionStringSettings connStringSettings
= ConfigurationManager.ConnectionStrings["NorthwindConnection"];


SqlConnection myConnection
= new SqlConnection(connStringSettings.ConnectionString);


SqlCommand myCommand = myConnection.CreateCommand();
myCommand.CommandText = "SELECT * FROM Employees WHERE City='Bangalore'";


SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);

DataSet myDataSet = new DataSet();

myAdapter.Fill(myDataSet, "Employees");


myConnection.Close();



Console.ReadLine();
}
}

Comments or Responses

Login to post response