1. Tag Results
sql-server-database (14)
1 - 14 of 14
How to bind the SQLite Database to the WinUI Chart (SfCartesianChart)?
This article demonstrates the connection establishment with the SQLite database and binds the retrieving data from the database to the WinUI Charts (SfCartesianChart).   Follow these steps to learn how to work with the WinUI Chart using the SQLite database.   Step 1: Add the SQLite reference in your project.   Step 2: Create the database access class as follows. public class ChartDatabase {     readonly SQLiteConnection _database;       public ChartDatabase(string dbPath)     {         _database = new SQLiteConnection(dbPath);         _database.CreateTable<ChartDataModel>();     }       //Get the list of ChartDataModel items from the database     public List<ChartDataModel> GetChartDataModel()     {         return _database.Table<ChartDataModel>().ToList();     }       //Insert an item in the database     public int SaveChartDataModelAsync(ChartDataModel chartDataModel)     {         if (chartDataModel == null)         {             throw new Exception("Null");         }           return _database.Insert(chartDataModel);     }       //Delete an item in the database     public int DeleteChartDataModelAsync(ChartDataModel chartDataModel)     {         return _database.Delete(chartDataModel);     } }   public partial class App : Application {     static ChartDatabase database;     …       public static ChartDatabase Database     {         get         {             if (database == null)             {                 database = new ChartDatabase(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ChartDataBase.db3"));             }             return database;         }     } }   Step 3: Now, create the following Model for the Chart data. public class ChartDataModel {     [PrimaryKey]     public string XValue { get; set; }     public double YValue { get; set; } }   Step 4: Bind the retrieved data from the Database to the Chart. <Page.DataContext>     <local:ViewModel/> </Page.DataContext>   <chart:SfCartesianChart>     <chart:SfCartesianChart.XAxes>         <chart:CategoryAxis/>     </chart:SfCartesianChart.XAxes>     <chart:SfCartesianChart.YAxes>         <chart:NumericalAxis/>     </chart:SfCartesianChart.YAxes>     <chart:ColumnSeries ItemsSource="{Binding Data}" XBindingPath="XValue" YBindingPath="YValue"/> </chart:SfCartesianChart>   Step 5: Retrieving the database data of Chart as follows. public partial class ChartSample : Page {  public ChartSample()  {           InitializeComponent();                         (DataContext as ViewModel).Data = App.Database.GetChartDataModel();               } }   Output: Initial page to display the SQLite database data   Inserting an item into the database   After inserting data into the database   Display the chart with generated data View sample in GitHub
How to bind the SQLite Database to the .NET MAUI Chart?
This article demonstrates the connection establishment with the SQLite database and binds the retrieving data from the database to the .NET MAUI Charts.   Follow these steps to learn how to work with the .NET MAUI Chart using the SQLite database.   Step 1: Add the SQLite reference in your project.   Step 2: Create the database access class as follows. public class ChartDatabase {     readonly SQLiteConnection _database;       public ChartDatabase(string dbPath)     {         _database = new SQLiteConnection(dbPath);         _database.CreateTable<ChartDataModel>();     }       //Get the list of ChartDataModel items from the database     public List<ChartDataModel> GetChartDataModel()     {         return _database.Table<ChartDataModel>().ToList();     }       //Insert an item in the database     public int SaveChartDataModelAsync(ChartDataModel chartDataModel)     {         if (chartDataModel == null)         {             throw new Exception("Null");         }           return _database.Insert(chartDataModel);     }       //Delete an item in the database     public int DeleteChartDataModelAsync(ChartDataModel chartDataModel)     {         return _database.Delete(chartDataModel);     } }   public partial class App : Application {     static ChartDatabase database;     …       public static ChartDatabase Database     {         get         {             if (database == null)             {                 database = new ChartDatabase(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ChartDataBase.db3"));             }             return database;         }     } }   Step 3: Now, create the following Model for the Chart data. public class ChartDataModel {     [PrimaryKey]     public string XValue { get; set; }     public double YValue { get; set; } }   Step 4: Bind the retrieved data from the Database to the Chart. <ContentPage.BindingContext>     <local:ViewModel/> </ContentPage.BindingContext>   <chart:SfCartesianChart>     <chart:SfCartesianChart.XAxes>         <chart:CategoryAxis/>     </chart:SfCartesianChart.XAxes>     <chart:SfCartesianChart.YAxes>         <chart:NumericalAxis/>     </chart:SfCartesianChart.YAxes>     <chart:ColumnSeries ItemsSource="{Binding Data}" XBindingPath="XValue" YBindingPath="YValue"/> </chart:SfCartesianChart>   Step 5: Retrieving the database data of Chart as follows. public partial class ChartSample : ContentPage {  public ChartSample()  {           InitializeComponent();                         (BindingContext as ViewModel).Data = App.Database.GetChartDataModel();               } }   Output: Initial page to display the SQLite database data Inserting an item into the database   After inserting data into the database   Display the chart with generated data View sample in GitHub Conclusion I hope you enjoyed learning about how to bind the SQLite Database to the MAUI Chart (SfCartesianChart).You can refer to our .NET MAUI Chart’s feature tour page to know about its other groundbreaking feature representations. For current customers, you can check out our .NET MAUI components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our .NET MAUI Charts and other .NET MAUI components. If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
How to bind SQL Server data in Vue DataGrid using SqlClient data provider?
You can bind the data from the SQL Server using Microsoft SqlClient and perform CRUD actions in the Vue DataGrid component. This can be achieved by using UrlAdaptor which will pass the paging, filtering, sorting parameters to the server as DataManagerRequest and perform server side CRUD actions in DataGrid component. Based on the DataManagerRequest, you can form the SQL query string and retrieve the data from the database using SqlDataAdapter. And then, we process the query string and fill the result into DataSet. Then the DataSet will be converted into List and returned as result and count pair. This is explained in the following sample code in which the SQL data has been retrieved using SqlClient and bound to the Vue DataGrid through UrlAdaptor. C# [Fetching data] public class HomeController : Controller     {                 private readonly IHostingEnvironment _env;           public HomeController(IHostingEnvironment env)         {             _env = env;         }           static string cons;         static SqlConnection con;         public static List<Order> Orders { get; set; }           public IActionResult Index()         {             cons = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=" + _env.ContentRootPath + @"\Data\NORTHWND.MDF;Integrated Security=True";             con = new SqlConnection(cons);             return View();         }         public static DataSet CreateCommand(string queryString, string connectionString)         {             using (SqlConnection connection = new SqlConnection(                        connectionString))             {                   SqlDataAdapter adapter = new SqlDataAdapter(queryString, connection);                 DataSet dt = new DataSet();                 try                 {                     connection.Open();                     adapter.Fill(dt); //Using SqlDataAdapter we process the query string and fill the data into dataset                 }                 catch (SqlException se)                 {                     Console.WriteLine(se.ToString());                 }                 finally                 {                     connection.Close();                 }                 return dt;             }         }         public object UrlDatasource([FromBody]DataManagerRequest dm)         {             string qs = "SELECT OrderID, ShipCountry, ShipCity FROM dbo.Orders ORDER BY OrderID OFFSET " + dm.Skip + "ROWS FETCH NEXT " + dm.Take + " ROWS ONLY; ";               if (dm.Skip == 0 && dm.Take == 0)             {                 qs = "SELECT OrderID, ShipCountry, ShipCity FROM dbo.Orders ORDER BY OrderID; ";             }               DataSet data = CreateCommand(qs, cons);             Orders = data.Tables[0].AsEnumerable().Select(r => new Order             {                 OrderID = r.Field<int>("OrderID"),                 ShipCountry = r.Field<string>("ShipCountry"),                 ShipCity = r.Field<string>("ShipCity"),             }).ToList();  // Here, We have converted dataset into list             IEnumerable<Order> DataSource = Orders;             if (con.State != ConnectionState.Open)                 con.Open();             SqlCommand comm = new SqlCommand("SELECT COUNT(*) FROM dbo.Orders", con);             Int32 count = (Int32)comm.ExecuteScalar();             con.Close();             return Json(new { result = DataSource, count = count });         }         public class DataResult         {             public IEnumerable result { get; set; }             public int count { get; set; }         }   [Insert]     public ActionResult Insert([FromBody]CRUDModel<Order> value)         {             SqlCommand cmd = new SqlCommand("insert into dbo.Orders(OrderID,ShipCountry,ShipCity) values(@OrderID,@ShipCountry,@ShipCity)", con);             if (con.State != ConnectionState.Open)                 con.Open();             cmd.Parameters.AddWithValue("@OrderID", value.Value.OrderID);             cmd.Parameters.AddWithValue("@ShipCountry", value.Value.ShipCountry);             cmd.Parameters.AddWithValue("@ShipCity", value.Value.ShipCity);             cmd.ExecuteNonQuery();             con.Close();             return Json(value);         }     [Update]      public ActionResult Update([FromBody]CRUDModel<Order> value)         {             SqlCommand cmd = new SqlCommand("update dbo.Orders set ShipCountry=@ShipCountry,ShipCity=@ShipCity where OrderID=@OrderID", con);             if (con.State != ConnectionState.Open)                 con.Open();             cmd.Parameters.AddWithValue("@OrderID", value.Value.OrderID);             cmd.Parameters.AddWithValue("@ShipCountry", value.Value.ShipCountry);             cmd.Parameters.AddWithValue("@ShipCity", value.Value.ShipCity);             cmd.ExecuteNonQuery();             con.Close();             return Json(value.Value);         }     }   [Remove]         public ActionResult Remove([FromBody]CRUDModel value)         {             int keyValue = Int32.Parse(value.Key.ToString());             SqlCommand cmd = new SqlCommand("delete dbo.Orders where OrderID=@OrderID", con);             if (con.State != ConnectionState.Open)                 con.Open();             cmd.Parameters.AddWithValue("@OrderID", keyValue);             cmd.ExecuteNonQuery();             con.Close();             return Json(UrlDatasource(new DataManagerRequest()));         }     Vue <template>     <div>         <ejs-grid :dataSource="data" :toolbar="toolbar" allowPaging="true" :editSettings="editSettings">             <e-columns>                 <e-column field="OrderID" headerText="Order ID" :isPrimaryKey="true" :validationRules="orderidRules" textAlign="Right" width="100"></e-column>                 <e-column field="ShipCountry" headerText="Ship Country" width="120"></e-column>                 <e-column field="ShipCity" headerText="Ship City" width="120"></e-column>             </e-columns>         </ejs-grid>     </div> </template> <script>   import Vue from "vue"; import { GridPlugin, Edit, Page, Toolbar } from "@syncfusion/ej2-vue-grids"; import { DataManager, UrlAdaptor } from "@syncfusion/ej2-data";   Vue.use(GridPlugin);   export default Vue.extend({     data: () => {         return {            data: new DataManager({                 url: "Home/UrlDatasource",                 updateUrl: "Home/Update",                 insertUrl: "Home/Insert",                 removeUrl: "Home/Remove",                 adaptor: new UrlAdaptor()             }),             toolbar: ['Add', 'Edit', 'Delete', 'Update', 'Cancel'],             editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },             orderidRules: {required:true}          }     },     provide: {         grid: [Edit, Page, Toolbar ]     } }); </script>     Demo: https://www.syncfusion.com/downloads/support/directtrac/general/ze/VueSqlDataGrid1126509960
How to bind SQL Server data in ASP.Net Core DataGrid using SqlClient data provider?
You can bind the data from the SQL Server using Microsoft SqlClient and perform CRUD actions in the ASP.NET CORE DataGrid component. This can be achieved using UrlAdaptor which will pass the paging, filtering, sorting parameters to the server as DataManagerRequest and perform server side CRUD actions in DataGrid component. Based on the DataManagerRequest, you can form the SQL query string and retrieve the data from the database using SqlDataAdapter. And then, we process the query string and fill the result into DataSet. Then the DataSet will be converted into List and returned as result and count pair. This is explained in the following sample code in which the SQL data has been retrieved using SqlClient and bound to the ASP.NET CORE DataGrid through UrlAdaptor. C# [Fetching data] public class HomeController : Controller     {                 private readonly IHostingEnvironment _env;           public HomeController(IHostingEnvironment env)         {             _env = env;         }           static string cons;         static SqlConnection con;         public static List<Order> Orders { get; set; }           public IActionResult Index()         {             cons = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=" + _env.ContentRootPath + @"\Data\NORTHWND.MDF;Integrated Security=True";             con = new SqlConnection(cons);             return View();         }         public static DataSet CreateCommand(string queryString, string connectionString)         {             using (SqlConnection connection = new SqlConnection(                        connectionString))             {                   SqlDataAdapter adapter = new SqlDataAdapter(queryString, connection);                 DataSet dt = new DataSet();                 try                 {                     connection.Open();                     adapter.Fill(dt); // Using SqlDataAdapter we process the query string and fill the data into dataset                 }                 catch (SqlException se)                 {                     Console.WriteLine(se.ToString());                 }                 finally                 {                     connection.Close();                 }                 return dt;             }         }         public object UrlDatasource([FromBody]DataManagerRequest dm)         {             string qs = "SELECT OrderID, ShipCountry, ShipCity FROM dbo.Orders ORDER BY OrderID OFFSET " + dm.Skip + "ROWS FETCH NEXT " + dm.Take + " ROWS ONLY; ";               if (dm.Skip == 0 && dm.Take == 0)             {                 qs = "SELECT OrderID, ShipCountry, ShipCity FROM dbo.Orders ORDER BY OrderID; ";             }               DataSet data = CreateCommand(qs, cons);             Orders = data.Tables[0].AsEnumerable().Select(r => new Order             {                 OrderID = r.Field<int>("OrderID"),                 ShipCountry = r.Field<string>("ShipCountry"),                 ShipCity = r.Field<string>("ShipCity"),             }).ToList();  // Here, we have converted dataset into list             IEnumerable<Order> DataSource = Orders;             if (con.State != ConnectionState.Open)                 con.Open();             SqlCommand comm = new SqlCommand("SELECT COUNT(*) FROM dbo.Orders", con);             Int32 count = (Int32)comm.ExecuteScalar();             con.Close();             return Json(new { result = DataSource, count = count });         }         public class DataResult         {             public IEnumerable result { get; set; }             public int count { get; set; }         }   [Insert]     public ActionResult Insert([FromBody]CRUDModel<Order> value)         {             SqlCommand cmd = new SqlCommand("insert into dbo.Orders(OrderID,ShipCountry,ShipCity) values(@OrderID,@ShipCountry,@ShipCity)", con);             if (con.State != ConnectionState.Open)                 con.Open();             cmd.Parameters.AddWithValue("@OrderID", value.Value.OrderID);             cmd.Parameters.AddWithValue("@ShipCountry", value.Value.ShipCountry);             cmd.Parameters.AddWithValue("@ShipCity", value.Value.ShipCity);             cmd.ExecuteNonQuery();             con.Close();             return Json(value);         }     [Update]      public ActionResult Update([FromBody]CRUDModel<Order> value)         {             SqlCommand cmd = new SqlCommand("update dbo.Orders set ShipCountry=@ShipCountry,ShipCity=@ShipCity where OrderID=@OrderID", con);             if (con.State != ConnectionState.Open)                 con.Open();             cmd.Parameters.AddWithValue("@OrderID", value.Value.OrderID);             cmd.Parameters.AddWithValue("@ShipCountry", value.Value.ShipCountry);             cmd.Parameters.AddWithValue("@ShipCity", value.Value.ShipCity);             cmd.ExecuteNonQuery();             con.Close();             return Json(value);         }     }   [Remove]         public ActionResult Remove([FromBody]CRUDModel value)         {             int keyValue = Int32.Parse(value.Key.ToString());             SqlCommand cmd = new SqlCommand("delete dbo.Orders where OrderID=@OrderID", con);             if (con.State != ConnectionState.Open)                 con.Open();             cmd.Parameters.AddWithValue("@OrderID", keyValue);             cmd.ExecuteNonQuery();             con.Close();             return Json(UrlDatasource(new DataManagerRequest()));         }     Razor <ejs-grid id="Grid" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })" allowPaging="true">     <e-data-manager url="Home/UrlDatasource" insertUrl="/Home/Insert" updateUrl="/Home/Update" removeUrl="/Home/Remove" adaptor="UrlAdaptor"></e-data-manager>     <e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true "></e-grid-editSettings>     <e-grid-columns>         <e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" validationRules="@(new { required=true })" textAlign="Right" width="100"></e-grid-column>         <e-grid-column field="ShipCountry" headerText="Ship Country" width="120"></e-grid-column>         <e-grid-column field="ShipCity" headerText=" Ship City " width="120"></e-grid-column>     </e-grid-columns> </ejs-grid>     Demo: https://www.syncfusion.com/downloads/support/directtrac/general/ze/CoreSqlDataGrid-1462712780
How to bind SQL Server data in React DataGrid using SqlClient data provider?
You can bind the data from the SQL Server using Microsoft SqlClient and perform CRUD actions in React DataGrid component. This can be achieved using UrlAdaptor which will pass the paging, filtering, sorting parameters to the server as DataManagerRequest and perform server side CRUD actions in DataGrid component. Based on the DataManagerRequest, you can form SQL query string and retrieve the data from database using SqlDataAdapter. And then, we process the query string and fill the result into DataSet. Then the DataSet is converted into List and returned as result and count pair. This is demonstrated in the below sample code in which the SQL data has been retrieved using SqlClient and bound to React DataGrid through UrlAdaptor. C# [Fetching data] public class HomeController : Controller     {                 private readonly IHostingEnvironment _env;           public HomeController(IHostingEnvironment env)         {             _env = env;         }           static string cons;         static SqlConnection con;         public static List<Order> Orders { get; set; }           public IActionResult Index()         {             cons = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=" + _env.ContentRootPath + @"\Data\NORTHWND.MDF;Integrated Security=True";             con = new SqlConnection(cons);             return View();         }         public static DataSet CreateCommand(string queryString, string connectionString)         {             using (SqlConnection connection = new SqlConnection(                        connectionString))             {                   SqlDataAdapter adapter = new SqlDataAdapter(queryString, connection);                 DataSet dt = new DataSet();                 try                 {                     connection.Open();                     adapter.Fill(dt); // Using SqlDataAdapter we process the query string and fill the data into dataset                 }                 catch (SqlException se)                 {                     Console.WriteLine(se.ToString());                 }                 finally                 {                     connection.Close();                 }                 return dt;             }         }         public object UrlDatasource([FromBody]DataManagerRequest dm)         {                         string qs = "SELECT OrderID, ShipCountry, ShipCity FROM dbo.Orders ORDER BY OrderID";             if (dm.Take != 0)             {                 qs = qs + " OFFSET " + dm.Skip + "ROWS FETCH NEXT " + dm.Take + " ROWS ONLY; ";             }else             {                 qs = qs + "; ";             }             DataSet data = CreateCommand(qs, cons);             Orders = data.Tables[0].AsEnumerable().Select(r => new Order             {                 OrderID = r.Field<int>("OrderID"),                 ShipCountry = r.Field<string>("ShipCountry"),                 ShipCity = r.Field<string>("ShipCity"),             }).ToList();  // Here we have converted dataset into list             IEnumerable<Order> DataSource = Orders;             if (con.State != ConnectionState.Open)                 con.Open();             SqlCommand comm = new SqlCommand("SELECT COUNT(*) FROM dbo.Orders", con);             Int32 count = (Int32)comm.ExecuteScalar();             con.Close();             return Json(new { result = DataSource, count = count });         }         public class DataResult         {             public IEnumerable result { get; set; }             public int count { get; set; }         }   [Insert]     public ActionResult Insert([FromBody]CRUDModel<Order> value)         {             SqlCommand cmd = new SqlCommand("insert into dbo.Orders(OrderID,ShipCountry,ShipCity) values(@OrderID,@ShipCountry,@ShipCity)", con);             if (con.State != ConnectionState.Open)                 con.Open();             cmd.Parameters.AddWithValue("@OrderID", value.Value.OrderID);             cmd.Parameters.AddWithValue("@ShipCountry", value.Value.ShipCountry);             cmd.Parameters.AddWithValue("@ShipCity", value.Value.ShipCity);             cmd.ExecuteNonQuery();             con.Close();             return Json(value);         }     [Update]      public ActionResult Update([FromBody]CRUDModel<Order> value)         {             SqlCommand cmd = new SqlCommand("update dbo.Orders set ShipCountry=@ShipCountry,ShipCity=@ShipCity where OrderID=@OrderID", con);             if (con.State != ConnectionState.Open)                 con.Open();             cmd.Parameters.AddWithValue("@OrderID", value.Value.OrderID);             cmd.Parameters.AddWithValue("@ShipCountry", value.Value.ShipCountry);             cmd.Parameters.AddWithValue("@ShipCity", value.Value.ShipCity);             cmd.ExecuteNonQuery();             con.Close();             return Json(value);         }     }   [Remove]         public ActionResult Remove([FromBody]CRUDModel value)         {             int keyValue = Int32.Parse(value.Key.ToString());             SqlCommand cmd = new SqlCommand("delete dbo.Orders where OrderID=@OrderID", con);             if (con.State != ConnectionState.Open)                 con.Open();             cmd.Parameters.AddWithValue("@OrderID", keyValue);             cmd.ExecuteNonQuery();             con.Close();             return Json(UrlDatasource(new DataManagerRequest()));         }     React public toolbarOptions: string[] = ['Add', 'Edit', 'Delete', 'Update', 'Cancel'];     public editSettings: object = { allowEditing: true, allowAdding: true, allowDeleting: true };     public orderidRules: object = { required: true };     constructor(props) {         super(props);           }     public dm: any = new DataManager({             url: "/Home/UrlDatasource",             insertUrl: "/Home/Insert",             updateUrl: "/Home/Update",             removeUrl:"/Home/Remove",             adaptor: new UrlAdaptor()         });     public render() {         return (<div className='control-section'>             <GridComponent ref={g => (this as any).grid = g} dataSource={this.dm} allowPaging={true} editSettings={this.editSettings} toolbar={this.toolbarOptions} >                 <ColumnsDirective>                     <ColumnDirective field='OrderID' headerText='Order ID' isPrimaryKey={true} validationRules={this.orderidRules} width='100' textAlign='Right'></ColumnDirective>                     <ColumnDirective field='ShipCountry' headerText='Ship Country' width='120'></ColumnDirective>                     <ColumnDirective field='ShipCity' headerText='Ship City' width='120' textAlign='Right' />                 </ColumnsDirective>                 <Inject services={[Page, Edit, Toolbar]} />             </GridComponent>         </div>)     }       }   Demo: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ReactSqlDataGrid371098985ConclusionI hope you enjoyed learning about how to bind SQL Server data in React DataGrid using SqlClient data provider.You can refer to our React Grid Picker feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our React Grid Picker example to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
How to bind SQL Server data in Angular DataGrid using SqlClient data provider?
You can bind the data from the SQL Server using Microsoft SqlClient and perform CRUD actions in the Angular DataGrid component. This can be achieved by using UrlAdaptor which will pass the paging, filtering, sorting parameters to the server as DataManagerRequest and perform server side CRUD actions in DataGrid component. Based on the DataManagerRequest, you can form the SQL query string and retrieve the data from the database using SqlDataAdapter. And then, we process the query string and fill the result into DataSet. Then the DataSet will be converted into List and returned as result and count pair. This is explained in the following sample code in which the SQL data has been retrieved using SqlClient and bound to the Angular DataGrid through UrlAdaptor. C# [Fetching data] public class HomeController : Controller     {                 private readonly IHostingEnvironment _env;           public HomeController(IHostingEnvironment env)         {             _env = env;         }           static string cons;         static SqlConnection con;         public static List<Order> Orders { get; set; }           public IActionResult Index()         {             cons = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=" + _env.ContentRootPath + @"\Data\NORTHWND.MDF;Integrated Security=True";             con = new SqlConnection(cons);             return View();         }         public static DataSet CreateCommand(string queryString, string connectionString)         {             using (SqlConnection connection = new SqlConnection(                        connectionString))             {                   SqlDataAdapter adapter = new SqlDataAdapter(queryString, connection);                 DataSet dt = new DataSet();                 try                 {                     connection.Open();                     adapter.Fill(dt); // Using SqlDataAdapter we process the query string and fill the data into dataset                 }                 catch (SqlException se)                 {                     Console.WriteLine(se.ToString());                 }                 finally                 {                     connection.Close();                 }                 return dt;             }         }         public object UrlDatasource([FromBody]DataManagerRequest dm)         {                         string qs = "SELECT OrderID, ShipCountry, ShipCity FROM dbo.Orders ORDER BY OrderID";             if (dm.Take != 0)             {                 qs = qs + " OFFSET " + dm.Skip + "ROWS FETCH NEXT " + dm.Take + " ROWS ONLY; ";             }else             {                 qs = qs + "; ";             }             DataSet data = CreateCommand(qs, cons);             Orders = data.Tables[0].AsEnumerable().Select(r => new Order             {                 OrderID = r.Field<int>("OrderID"),                 ShipCountry = r.Field<string>("ShipCountry"),                 ShipCity = r.Field<string>("ShipCity"),             }).ToList();  // Here, we have converted dataset into list             IEnumerable<Order> DataSource = Orders;             if (con.State != ConnectionState.Open)                 con.Open();             SqlCommand comm = new SqlCommand("SELECT COUNT(*) FROM dbo.Orders", con);             Int32 count = (Int32)comm.ExecuteScalar();             con.Close();             return Json(new { result = DataSource, count = count });         }         public class DataResult         {             public IEnumerable result { get; set; }             public int count { get; set; }         }   [Insert]     public ActionResult Insert([FromBody]CRUDModel<Order> value)         {             SqlCommand cmd = new SqlCommand("insert into dbo.Orders(OrderID,ShipCountry,ShipCity) values(@OrderID,@ShipCountry,@ShipCity)", con);             if (con.State != ConnectionState.Open)                 con.Open();             cmd.Parameters.AddWithValue("@OrderID", value.Value.OrderID);             cmd.Parameters.AddWithValue("@ShipCountry", value.Value.ShipCountry);             cmd.Parameters.AddWithValue("@ShipCity", value.Value.ShipCity);             cmd.ExecuteNonQuery();             con.Close();             return Json(value);         }     [Update]      public ActionResult Update([FromBody]CRUDModel<Order> value)         {             SqlCommand cmd = new SqlCommand("update dbo.Orders set ShipCountry=@ShipCountry,ShipCity=@ShipCity where OrderID=@OrderID", con);             if (con.State != ConnectionState.Open)                 con.Open();             cmd.Parameters.AddWithValue("@OrderID", value.Value.OrderID);             cmd.Parameters.AddWithValue("@ShipCountry", value.Value.ShipCountry);             cmd.Parameters.AddWithValue("@ShipCity", value.Value.ShipCity);             cmd.ExecuteNonQuery();             con.Close();             return Json(value.Value);         }     }   [Remove]         public ActionResult Remove([FromBody]CRUDModel value)         {             int keyValue = Int32.Parse(value.Key.ToString());             SqlCommand cmd = new SqlCommand("delete dbo.Orders where OrderID=@OrderID", con);             if (con.State != ConnectionState.Open)                 con.Open();             cmd.Parameters.AddWithValue("@OrderID", keyValue);             cmd.ExecuteNonQuery();             con.Close();             return Json(UrlDatasource(new DataManagerRequest()));         }     Angular @Component({   selector: 'app-root',   template: `<ejs-grid #grid [dataSource]='data' allowPaging='true' [editSettings]='editSettings' [toolbar]='toolbar'>     <e-columns>         <e-column field='OrderID' headerText='Order ID' isPrimaryKey=true [validationRules]='orderidrules' width='100' textAlign='Right'></e-column>         <e-column field='ShipCountry' headerText='Ship Country' width='120'></e-column>         <e-column field='ShipCity' headerText='Ship City' width='120'></e-column>     </e-columns> </ejs-grid>` }) export class AppComponent implements OnInit {   public data: DataManager;   public editSettings: Object;   public toolbar: string[];  public orderidrules: object;     @ViewChild('grid')   public grid: GridComponent;     ngOnInit(): void {     this.data = new DataManager({       url: "Home/UrlDatasource ",       updateUrl: "Home/Update",       insertUrl: "Home/Insert",       removeUrl: "Home/Remove",       adaptor: new UrlAdaptor     });     this.editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true };     this.toolbar = ['Add', 'Edit', 'Delete', 'Update', 'Cancel'];     this.orderidrules = { required: true};   } }     Demo: https://www.syncfusion.com/downloads/support/directtrac/general/ze/angularSqlDataGrid629818828ConclusionI hope you enjoyed learning about how to bind SQL Server data in Angular DataGrid using SqlClient data provider.You can refer to our Angular Grid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Angular Grid example to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
How to bind SQL Server data in TypeScript DataGrid using SqlClient data provider
You can bind the data from the SQL Server using Microsoft SqlClient and perform CRUD actions in the JavaScript DataGrid component. This can be achieved by using UrlAdaptor which will pass the paging, filtering, sorting parameters to the server as DataManagerRequest and perform server side CRUD actions in DataGrid component. Based on the DataManagerRequest, you can form the SQL query string and retrieve the data from the database using SqlDataAdapter. And then, we process the query string and fill the result into DataSet. Then the DataSet will be converted into List and returned as result and count pair. This is explained in the following sample code in which the SQL data has been retrieved using SqlClient and bound to the JavaScript DataGrid through UrlAdaptor. C# [Fetching data] public class HomeController : Controller     {         static string cons = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=" + HostingEnvironment.ApplicationPhysicalPath + @"App_Data\NORTHWND.MDF;Integrated Security=True";         static SqlConnection con = new SqlConnection(cons);         public ActionResult Index()         {             return View();         }           public static List<Order> Orders { get; set; }         public static DataSet CreateCommand(string queryString, string connectionString)         {             using (SqlConnection connection = new SqlConnection(                        connectionString))             {                   SqlDataAdapter adapter = new SqlDataAdapter(queryString, connection);                 DataSet dt = new DataSet();                 try                 {                     connection.Open();                     adapter.Fill(dt); // Using SqlDataAdapter we can process the query string and fill the data into dataset                 }                 catch (SqlException se)                 {                     Console.WriteLine(se.ToString());                 }                 finally                 {                     connection.Close();                 }                 return dt;             }         }           public object UrlDatasource(DataManagerRequest dm)         {             string qs = "SELECT OrderID, ShipCountry, ShipCity FROM dbo.Orders ORDER BY OrderID";             if (dm.Take != 0)             {                 qs = qs + " OFFSET " + dm.Skip + "ROWS FETCH NEXT " + dm.Take + " ROWS ONLY; ";             }else             {                 qs = qs + "; ";             }             DataSet data = CreateCommand(qs, cons);             Orders = data.Tables[0].AsEnumerable().Select(r => new Order             {                 OrderID = r.Field<int>("OrderID"),                 ShipCountry = r.Field<string>("ShipCountry"),                 ShipCity = r.Field<string>("ShipCity"),             }).ToList();  // Here, we have converted dataset into list             IEnumerable<Order> DataSource = Orders;             if (con.State != ConnectionState.Open)                 con.Open();             SqlCommand comm = new SqlCommand("SELECT COUNT(*) FROM dbo.Orders", con);             Int32 count = (Int32)comm.ExecuteScalar();             con.Close();             return Json(new { result = DataSource, count = count });         }         public class DataResult         {             public IEnumerable result { get; set; }             public int count { get; set; }         }   [Insert] public ActionResult Insert(Order value)         {             SqlCommand cmd = new SqlCommand("insert into dbo.Orders(ShipCountry,ShipCity) values(@ShipCountry,@ShipCity)", con);             if (con.State != ConnectionState.Open)                 con.Open();             cmd.Parameters.AddWithValue("@ShipCountry", value.ShipCountry);             cmd.Parameters.AddWithValue("@ShipCity", value.ShipCity);             cmd.ExecuteNonQuery();             con.Close();             return Json(value);         }   [Update] public ActionResult Update(Order value)         {             SqlCommand cmd = new SqlCommand("update dbo.Orders set ShipCountry=@ShipCountry,ShipCity=@ShipCity where OrderID=@OrderID", con);             if (con.State != ConnectionState.Open)                 con.Open();             cmd.Parameters.AddWithValue("@OrderID", value.OrderID);             cmd.Parameters.AddWithValue("@ShipCountry", value.ShipCountry);             cmd.Parameters.AddWithValue("@ShipCity", value.ShipCity);             cmd.ExecuteNonQuery();             con.Close();             return Json(value);         }   [Remove]         public ActionResult Remove(int key)         {             int keyValue = key;             SqlCommand cmd = new SqlCommand("delete dbo.Orders where OrderID=@OrderID", con);             if (con.State != ConnectionState.Open)                 con.Open();             cmd.Parameters.AddWithValue("@OrderID", keyValue);             cmd.ExecuteNonQuery();             con.Close();             return Json(UrlDatasource(new DataManagerRequest()));         }     TypeScript Grid.Inject(Page, Edit, Toolbar);   /**  * Sql Data sample  */ let data: DataManager = new DataManager({     url: "Home/UrlDatasource",     updateUrl: "Home/Update",     insertUrl: "Home/Insert",     removeUrl: "Home/Remove",     adaptor: new UrlAdaptor });   let grid: Grid = new Grid({     dataSource: data,     allowPaging:true,     toolbar: ['Add', 'Edit', 'Delete', 'Update', 'Cancel'],     editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true},     columns: [         { field: 'OrderID', headerText: 'Order ID', isPrimaryKey: true, validationRules: { required: true }, textAlign: 'Right', width: 100 },         { field: 'ShipCountry', headerText: 'Ship Country', width: 120 },         { field: 'ShipCity', headerText: 'Ship City', width: 120 }     ] }); grid.appendTo('#Grid');   Demo: https://www.syncfusion.com/downloads/support/directtrac/general/ze/TsSqlDataGrid944214531  
How to bind the SQL Database to WPF Charts?
This article explains how to establish the SQL connection and bind the retrieving data from database in a step by step process. Step 1: Retrieve the data table from the SQL DataSet using the connection string.     public class ViewModel     {         public ViewModel()         {             try             {                 SqlConnection thisConnection = new SqlConnection(ConnectionString);                 thisConnection.Open();                 string Get_Data = "SELECT * FROM ChartData";                 SqlCommand cmd = thisConnection.CreateCommand();                 cmd.CommandText = Get_Data;                 SqlDataAdapter sda = new SqlDataAdapter(cmd);                 DataSet ds = new DataSet();                 sda.Fill(ds);                 var table = ds.Tables[0];                 this.DataTable = table;             }             catch             {                 MessageBox.Show("DataBase Error");             }         }           public object DataTable { get; set; }           public static string ConnectionString         {             get             {                 string currentDir = System.Environment.CurrentDirectory;                 currentDir = currentDir.Substring(0, currentDir.Length - 10) + "\\LocalDataBase";                  return @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=" + currentDir + @"\SeriesItemsSource.mdf;Integrated Security=True";             }         }     }   Step 2: In the main page, initialize the SfChart control and bind the retrieved data. <Grid>         <Grid.DataContext>             <local:ViewModel></local:ViewModel>         </Grid.DataContext>                        <chart:SfChart Margin="10">                         <chart:SfChart.PrimaryAxis>                 <chart:NumericalAxis RangePadding="Additional"/>             </chart:SfChart.PrimaryAxis>               <chart:SfChart.SecondaryAxis>                 <chart:NumericalAxis RangePadding="Additional"/>             </chart:SfChart.SecondaryAxis>               <chart:ScatterSeries ItemsSource="{Binding DataTable}"                                 XBindingPath="xVal"                                 YBindingPath="yVal"/>         </chart:SfChart>          </Grid>     Download complete sample here
How to bind the SQLite Database to the Xamarin.Forms Chart?
This article demonstrates the connection establishment with the SQLite database, and bind the retrieving data from database to the Xamarin.Forms Chart (SfChart).   Let us start learning how to work with the Xamarin.Forms Chart using the SQLite database with the following steps:   Step 1: Add the  SQLite reference in your project.    Step 2: Create the database access class as follows,   public class ChartDatabase {         readonly SQLiteConnection _database;           public ChartDatabase(string dbPath)         {             _database = new SQLiteConnection(dbPath);             _database.CreateTable<ChartDataModel>();         }              //Get the list of ChartDataModel items from the database         public List<ChartDataModel> GetChartDataModel()         {             return _database.Table<ChartDataModel>().ToList();         }           //Insert an item in the database         public int SaveChartDataModelAsync(ChartDataModel chartDataModel)         {             if (chartDataModel == null)             {                 throw new Exception("Null");             }               return _database.Insert(chartDataModel);         }            //Delete an item in the database         public int DeleteChartDataModelAsync(ChartDataModel chartDataModel)         {             return _database.Delete(chartDataModel);         } }     public partial class App : Application {         …         public static ChartDatabase Database         {             get             {                 if (database == null)                 {                      database = new ChartDatabase(Path.Combine(                      Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),                                                   "ChartDataBase.db3"));                 }                 return database;             }         }         …. }   Step 3: Now, create the following Model for the Chart data.   public class ChartDataModel {         [PrimaryKey]         public string XValue { get; set; }         public double YValue { get; set; } }       Step 4: Bind the retrieved data from Database to SfChart.   <ContentPage.BindingContext>         <local:ViewModel/> </ContentPage.BindingContext> <ContentPage.Content>         <StackLayout>             <chart:SfChart x:Name="chart" HorizontalOptions="FillAndExpand"                                        VerticalOptions="FillAndExpand">                   …                 <chart:SfChart.Series>                     <chart:ColumnSeries ItemsSource="{Binding Data}" XBindingPath="XValue"                                        YBindingPath="YValue">                     </chart:ColumnSeries>                 </chart:SfChart.Series>             </chart:SfChart>         </StackLayout> </ContentPage.Content>   Retrieving the database data of Chart as follows.   public partial class ChartSample : ContentPage {       public ChartSample ()       {              InitializeComponent ();              (BindingContext as ViewModel).Data = App.Database.GetChartDataModel();       } } Output   Initial page to display the SQLite database data         Inserting an item to the database.       After inserting data into the database.           Display the chart with generated data Download the complete sample here  ConclusionI hope you enjoyed learning how to bind the SQLite Database to the Xamarin.Forms Chart.You can refer to our Xamarin. Forms Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Xamarin. Forms Charts example to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
How to perform the CRUD operations in SfSchedule using SQL database?
​This article ​explains how to connect the database with SfSchedule control and how to add, update, and delete data in database using SQL server. Steps: 1. Add a new database connection by clicking the add icon button in Server Explorer, and the Add Connection wizard appears with the default data source as Microsoft SQL Server Database File (SqlClient). In the Data source field, click Change, and the Change Data Source dialog appears; in this dialog, select the type of data source that you need. Microsoft SQL Server (SqlClient) is used here. You can also use MySQL database. Refer to MySQL to connect the MySQL.2. In the Server name field, click the Refresh button to select a server from the drop-down list. Enable Select or enter a database name radio button to select a database from the drop-down list under the Connect to a database option. Refer to ​Create a database  in SQL server.  3. Click Test Connection to check whether the connection with your database is succeeded. After the connection issucceeded, click OK button to add database in your server explorer.  ​    4. Drag Meeting_Table table into design view of MeetingDB.dbml. The Entity model diagram for meeting table is generated after it has been dropped into design view. You can enter the values in the Meeting_Table using the Show Table Data option. The meeting details are maintained as string in the database.       You can load the database created in previous step into SfSchedule using MeetingsDBDataContext, and it can be mapped to the custom appointments of schedule. Refer to this documentation to know more about schedule and custom appointments and mapping method.   C#    MeetingsDBDataContext = new MeetingsDBDataContext();               var MeetingsList = (from data in MeetingsDBDataContext.Meeting_Tables                                   select data).ToList();                  for (int i = 0; i < MeetingsList.Count; i++)               {                   Meetings.Add(new ScheduleMeeting()                   {                       MappedSubject = MeetingsList[i].Subject,                       MappedStartTime = Convert.ToDateTime(MeetingsList[i].StartTime),                       MappedEndTime = Convert.ToDateTime(MeetingsList[i].EndTime),                       MappedColor = newSolidColorBrush((Color)ColorConverter.ConvertFromString(MeetingsList[i].Color)),                       MappedIsAllDay = Convert.ToBoolean(MeetingsList[i].IsAllDay),                       AppointmentID = MeetingsList[i].ID.ToString()                   });               }       You can also add, update, and delete the data in database using MeetingsDBDataContext and Meeting_Table in AppointmentEditorClosed event, where you can get the edited appointment details.      private void Schedule_AppointmentEditorClosed(object sender, AppointmentEditorClosedEventArgs e)           {                  MeetingsDBDataContext scheduleMeetings = new MeetingsDBDataContext();               Meeting_Table meeting;                                if (e.Action == EditorClosedAction.Save)               {                   var editedAppointment = (e.EditedAppointment as ScheduleMeeting);                   var appointmentID = Convert.ToInt32(editedAppointment.AppointmentID);                      if (!e.IsNew)                   {                       meeting = (from data in scheduleMeetings.Meeting_Tables                                      where data.ID == appointmentID                                      select data).First() as Meeting_Table;                          meeting.Subject = editedAppointment.MappedSubject;                       meeting.StartTime = editedAppointment.MappedStartTime.ToString();                       meeting.EndTime = editedAppointment.MappedEndTime.ToString();                       meeting.Color = editedAppointment.MappedColor.ToString();                       meeting.IsAllDay = editedAppointment.MappedIsAllDay.ToString();                       meeting.ID = appointmentID;                   }                   else                   {                       meeting = new Meeting_Table();                          meeting.Subject = editedAppointment.MappedSubject;                       meeting.StartTime = editedAppointment.MappedStartTime.ToString();                       meeting.EndTime = editedAppointment.MappedEndTime.ToString();                       meeting.Color = editedAppointment.MappedColor.ToString();                       meeting.IsAllDay = editedAppointment.MappedIsAllDay.ToString();                       meeting.ID = appointmentID;                          scheduleMeetings.Meeting_Tables.InsertOnSubmit(meeting);                   }                                  scheduleMeetings.SubmitChanges();               }                  if (e.Action == EditorClosedAction.Delete)               {                   var editedAppointment = (e.OriginalAppointment as ScheduleMeeting);                   var appointmentID = Convert.ToInt32(editedAppointment.AppointmentID);                      meeting = (from data in scheduleMeetings.Meeting_Tables                              where data.ID == appointmentID                              select data).First() as Meeting_Table;                      scheduleMeetings.Meeting_Tables.DeleteOnSubmit(meeting);                   scheduleMeetings.SubmitChanges();               }              }       }           Sample You can find the sample in the following link: Sample
How can SfSchedule's SQL database be used to conduct CRUD operations?
​This article explains how to connect the database with WPF Schedule(SfSchedule) control and how to add, update, and delete data in database using SQL server. Steps:1. Add a new database connection by clicking the add icon button in Server Explorer, and the Add Connection wizard appears with the default data source as Microsoft SQL Server Database File (SqlClient). In the Data source field, click Change, and the Change Data Source dialog appears; in this dialog, select the type of data source that you need. Microsoft SQL Server (SqlClient) is used here. You can also use MySQL database. Refer to MySQL to connect the MySQL.2. In the Server name field, click the Refresh button to select a server from the drop-down list. Enable Select or enter a database name radio button to select a database from the drop-down list under the Connect to a database option. Refer to ​Create a database to create a database in SQL server.  3. Click Test Connection to check whether the connection with your database is succeeded. After the connection issucceeded, click OK button to add database in your server explorer.  ​      4. Drag Meeting_Table table into design view of MeetingDB.dbml. The Entity model diagram for meeting table is generated after it has been dropped into design view. You can enter the values in the Meeting_Table using the Show Table Data option. The meeting details are maintained as string in the database.     You can load the database created in previous step into SfSchedule using MeetingsDBDataContext, and it can be mapped to the custom appointments of schedule. Refer to this documentation to know more about schedule and custom appointments and mapping method.   C#    MeetingsDBDataContext = new MeetingsDBDataContext();               var MeetingsList = (from data in MeetingsDBDataContext.Meeting_Tables                                   select data).ToList();                  for (int i = 0; i < MeetingsList.Count; i++)               {                   Meetings.Add(new ScheduleMeeting()                   {                       MappedSubject = MeetingsList[i].Subject,                       MappedStartTime = Convert.ToDateTime(MeetingsList[i].StartTime),                       MappedEndTime = Convert.ToDateTime(MeetingsList[i].EndTime),                       MappedColor = newSolidColorBrush((Color)ColorConverter.ConvertFromString(MeetingsList[i].Color)),                       MappedIsAllDay = Convert.ToBoolean(MeetingsList[i].IsAllDay),                       AppointmentID = MeetingsList[i].ID.ToString()                   });               }       You can also add, update, and delete the data in database using MeetingsDBDataContext and Meeting_Table in AppointmentEditorClosed event, where you can get the edited appointment details.      private void Schedule_AppointmentEditorClosed(object sender, AppointmentEditorClosedEventArgs e)           {                  MeetingsDBDataContext scheduleMeetings = new MeetingsDBDataContext();               Meeting_Table meeting;                                if (e.Action == EditorClosedAction.Save)               {                   var editedAppointment = (e.EditedAppointment as ScheduleMeeting);                   var appointmentID = Convert.ToInt32(editedAppointment.AppointmentID);                      if (!e.IsNew)                   {                       meeting = (from data in scheduleMeetings.Meeting_Tables                                      where data.ID == appointmentID                                      select data).First() as Meeting_Table;                          meeting.Subject = editedAppointment.MappedSubject;                       meeting.StartTime = editedAppointment.MappedStartTime.ToString();                       meeting.EndTime = editedAppointment.MappedEndTime.ToString();                       meeting.Color = editedAppointment.MappedColor.ToString();                       meeting.IsAllDay = editedAppointment.MappedIsAllDay.ToString();                       meeting.ID = appointmentID;                   }                   else                   {                       meeting = new Meeting_Table();                          meeting.Subject = editedAppointment.MappedSubject;                       meeting.StartTime = editedAppointment.MappedStartTime.ToString();                       meeting.EndTime = editedAppointment.MappedEndTime.ToString();                       meeting.Color = editedAppointment.MappedColor.ToString();                       meeting.IsAllDay = editedAppointment.MappedIsAllDay.ToString();                       meeting.ID = appointmentID;                          scheduleMeetings.Meeting_Tables.InsertOnSubmit(meeting);                   }                                  scheduleMeetings.SubmitChanges();               }                  if (e.Action == EditorClosedAction.Delete)               {                   var editedAppointment = (e.OriginalAppointment as ScheduleMeeting);                   var appointmentID = Convert.ToInt32(editedAppointment.AppointmentID);                      meeting = (from data in scheduleMeetings.Meeting_Tables                              where data.ID == appointmentID                              select data).First() as Meeting_Table;                      scheduleMeetings.Meeting_Tables.DeleteOnSubmit(meeting);                   scheduleMeetings.SubmitChanges();               }              }       }           Sample You can find the sample in the following link: Sample
How to connect and update changes from Gantt using Entity Framework
In Gantt, we can load data from SQL database using ADO.NET Entity Data Model and can update the changes to the SQL database on CRUD operations. Please refer following link to create the ADO.NET Entity Data Model in Visual studio, Link: https://docs.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/models-data/creating-model-classes-with-the-entity-framework-cs SQL database connection in Gantt can be established by using data model entity class. The Data Model entity class name is used as the connectionString name to establish the connection with the SQL database. The ‘connectionStrings’ will be automatically create in our web.config file once entity data model get generated. Please refer following code snippet for adding SQL connection in web.config   CRUD actions are performed by entity classes to update Gantt data using the client side event ActionComplete and with PageMethods. The event argument requestType of the ActionComplete client-side event is used to identify the type of action performed in Gantt such as update, delete, add new task.   Please refer the below code example for updating the changes to the SQL database. Web Page Code[ASPX]:       Code Behind[C#]: Creating Gantt object     Connecting SQL database and fetching records from database:   Add method to add new tasks to SQL database:     Update method to update the changes from Gantt to SQL database:     Delete method to delete the tasks from SQL database   A simple sample to add, edit, delete and update the Gantt data using ADO.NET Entity Data Model. Please find the sample from the following location. Sample
How to add permission for IIS Application pool to access SQL Server Database?
Usually we use LocalSystem as the Identity to in IIS to run as built-in account by default. If this LocalSystem account does not have access to the SQL Server database that you have chosen in the startup of the Report Server, then you will need to change this application pool setting in IIS to set the account which has access to the database. Please follow the below steps to do this. Step 1: Open IIS à Application Pool and select SyncfusionReportServer.   Step 2: Right click on “SyncfusionReportServer” and select “Advanced Settings”.   Step 3: Choose “Options” in the “Identity” under “Process Model”.   Step 4: Choose “Custom Account” and select “Set” to set the account that has access to the SQL Server database.   Step 5: Type the “User name” and “Password” and click on “OK”.   Now the Report Server application will have access to its database using this account.
How to update credential details on the connection string for Report Server MS SQL Server database ?
How to update credential details on the connection string for Report Server MS SQL Server database ? The credentials used to connect to the Report Server database in the Syncfusion Report Server can be changed at any time. Report Server is deployed in the below location by default. {Windows_Drive}\Syncfusion\Report Server\ReportServer.web\ For example, C:\Syncfusion\Report Server\ReportServer.web\ We have shipped a utility with the Syncfusion Report Server application in the below location. {Windows_Drive}\Syncfusion\Report Server\Utilities\ConnectionStringEditor   Figure 1: ConnectionStringEditor utility installed location.   Follow the below steps to change the Database Credentials, Step 1: Stop the Report Server from the Desktop shortcut – “Stop Syncfusion Report Server” Figure 2: Stop Syncfusion Report Server. Step 2: Open the ConnectionStringEditor.exe tool in installed location.     Figure 3: Syncfusion Report Server - Connection String Editor form display.   Step 3: The connection details that were supplied while starting up the Report Server application will be populated in the utility. The utility will allow to change the Authentication Type and the Server and Database name will not be able to change. Figure 4: Select Windows Authentication type. Figure 5: Select SQL Server Authentication type. Note: This utility cannot be used when SQL CE database is chosen as the Report Server database in the Syncfusion Report Server. Step 4: If “SQL Server Authentication” type selected it requires Login and Password to fill. In case of “Windows Authentication” type it doesn’t need to be filled. After filling the connection details proceed to save. The utility will test the connection to the database with the given details. If the connection test passes, the new connection details will be updated in the connection string of the Report Server database.   Figure 6: Save the connection details.   The tool will change the Database Credentials and will return a “success” message if the process underwent successfully. If there is an error occurred in the process, the tool will generate an error log in text format in the below location and display the error log file name. Error log file location: %temp%/Syncfusion Report Server/{file_name} Please create a support incident attaching this error log file for us to check the issue and give a solution.
No articles found
No articles found
1 of 1 pages (14 items)