To fill table into dataset in

Posted by Jitendrasoft09 under C# category on | Points: 40 | Views : 613
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");



Comments or Responses

Login to post response