using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Data;
namespace DATASET_Handling
{
class Program
{
static void Main(string[] args)
{
SqlConnection sqlcon = new SqlConnection("Integrated Security= SSPI;Initial Catalog=sangram;Data Source=(Local) ");
sqlcon.Open();
SqlDataAdapter sqlda = new SqlDataAdapter("select * from course", sqlcon);
DataSet ds = new DataSet();
sqlda.Fill(ds, "course");
foreach (DataRow drow in ds.Tables["course"].Rows )
{
Console.Write("Cno:"+ drow["cno"].ToString());
Console.Write(" Cname:"+ drow["cname"]);
Console.Write(" Duration:" + drow["duration"].ToString());
Console.Write(" Fees:"+ drow["fees"].ToString());
Console.WriteLine();
}
sqlcon.Close();
Console.WriteLine("Program Finished");
Console.ReadKey();
}
}
}
No comments:
Post a Comment