The Customer class stores the database connection string in a static variable (strConn). SqlDataAdapter da = new SqlDataAdapter("select distinct SqlDataAdapter da = new SqlDataAdapter() SqlCommand cmdDelete = new SqlCommand(sqlDelete,cnn) SqlCommand cmdUpdate = new SqlCommand(sqlUpdate,cnn) SqlCommand cmdInsert = new SqlCommand(sqlInsert,cnn) SqlInsert = "insert into customers(customerid,companyname,Ĭontactname,country) = "update customers set where = "delete from customers where pInsert = new SqlParameter SqlConnection cnn = new SqlConnection(strConn) Public static void UpdateDataSet(DataSet ds) SqlDataAdapter da = new SqlDataAdapter("select customerid,Ĭompanyname,contactname,country from customers", strConn) Then, add a new class named Customer to the project and add the following code to it. To begin with, create a new Windows application using C# as the programming language (see Figure 1). You will develop a Windows application that displays data from Customers table using the DataGridView control. Although the Customers table contains many columns, you will restrict your examples to use the CustomerID, CompanyName, ContactName, and Country columns only. So, make sure that you have installed the Northwind database in your installation of SQL Server. Throughout the examples, you will use the Customers table of the Northwind database.
0 Comments
Leave a Reply. |