Thursday, 19 July 2018

SQL 2017 Hosting Server Tips: How to using CommandBuilder Insert Data in Datadase?

Leave a Comment
In this tutorial, let me show you how to using CommandBuilder to insert data in database. To automatically generate SQL statements for a DataAdapter, first set the SelectCommand property of the DataAdapter, then create a CommandBuilder object, and specify as an argument the DataAdapter for which the CommandBuilder will automatically generate SQL statements. This is the best and optimize way of insert data in to database table with ado.net.


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

public class InsertingDataUsingCommandBuilder
{
static void Main(string[] args)
 {
string Cn="DataSource=(local);InitialCatalog=CaseManager;Integrated Security=true";
string Query="SELECT ID, Contact, Email FROM Test";
SqlConnection objConnection = new SqlConnection(Cn);
SqlDataAdapter objDataAdapter = new SqlDataAdapter(Query,objConnection);
SqlCommandBuilder objCmd = new SqlCommandBuilder(objDataAdapter);
DataSet objDataSet = new DataSet();
objDataAdapter.Fill(objDataSet);
DataRow objRow = objDataSet.Tables[0].NewRow();
objRow["ID"] = 520;
objRow["Contact"] = "Bill";
objRow["Email"] = "Ray";
objDataSet.Tables[0].Rows.Add(objRow);
objDataAdapter.Update(objDataSet);
        }
    }

Best SQL 2017 Hosting Recommendation

One of the most important things when choosing a good SQL 2017 hosting is the feature and reliability. HostForLIFE is the leading provider of Windows hosting and affordable SQL 2017, their servers are optimized for PHP web applications. The performance and the uptime of the hosting service are excellent and the features of the web hosting plan are even greater than what many hosting providers ask you to pay for. 

At HostForLIFEASP.NET, customers can also experience fast SQL 2017 hosting. The company invested a lot of money to ensure the best and fastest performance of the datacenters, servers, network and other facilities. Its datacenters are equipped with the top equipments like cooling system, fire detection, high speed Internet connection, and so on. That is why HostForLIFEASP.NET guarantees 99.9% uptime for SQL 2017. And the engineers do regular maintenance and monitoring works to assure its Orchard hosting are security and always up.

0 comments:

Post a Comment