Answers for "how to retrieve data from database in c# using datatable"

C#
0

how to retrieve data from database in c# using datatable

using System.Data;
using System.Data.SqlClient;

public DataTable StudentView()
{
    SqlConnection sqlCon = new SqlConnection(@"Server= localhost\SQLINSTANCENAME; Database= DBNAME; Integrated Security=True;");

    SqlDataAdapter sqlDa = new SqlDataAdapter("QUERY", sqlCon);

    DataTable dtbl = new DataTable();
    sqlDa.Fill(dtbl);

    return dtbl;
}
Posted by: Guest on September-20-2021

Code answers related to "how to retrieve data from database in c# using datatable"

C# Answers by Framework

Browse Popular Code Answers by Language