Steps involved to fill a dataset, DOT NET Programming

Assignment Help:

What are the steps involved to fill a dataset ?

The sample code is shown below:

Private Sub LoadData()

Dim strConnectionString As String

strConnectionString = AppSettings.Item("ConnectionString") Dim objConn As New SqlConnection(strConnectionString) objConn.Open()

Dim objCommand As New SqlCommand("Select FirstName from

Employees")

objCommand.Connection = objConn

Dim objDataAdapter As New SqlDataAdapter() objDataAdapter.SelectCommand = objCommand Dim objDataSet As New DataSet

End Sub

In this type of questions interviewer is looking from the practical angle, that have you worked with dataset & datadapters. Let me try to explain the above code first and then we go to what steps must be told during the interview.

Dim objConn As New SqlConnection(strConnectionString)

objConn.Open()

The First step is to open the connection. Now again note the connection string is loaded from the config file.

Dim objCommand As New SqlCommand("Select FirstName from Employees") objCommand.Connection = objConn

The Second step is to create a command object with the appropriate SQL and set the connection object to this command

Dim objDataAdapter As New SqlDataAdapter()

objDataAdapter.SelectCommand = objCommand

The Third steps is to create an  Adapter object and pass the command object to the adapter object.

objDataAdapter.Fill(objDataSet)

The Fourth step is to load the dataset using the "Fill" method of the dataadapter.

lstData.DataSource = objDataSet.Tables(0).DefaultView

lstData.DisplayMember = "FirstName"

lstData.ValueMember = "FirstName"

The Fifth step is to bind to the loaded dataset with the GUI. At that moment the sample has a listbox as the UI. The Binding of the UI is completed by using the DefaultView of the dataset. Just to revise each dataset has tables and each table has views. In this sample we have only loaded one table that is Employees table so we are referring that with an index of zero.


Related Discussions:- Steps involved to fill a dataset

I need to develop a project of call accounting and billing, Project Descrip...

Project Description: General information for the business: Call Accounting and Billing Kind of development: New program from scratch Description of each module: Call Accou

Downloadable software for a pc computer and mac, Downloadable software for ...

Downloadable software for a PC computer and Mac Project Description: "The software" can be sold as a downloadable purchase. I must have all copy rights to "the software" when

Need a excel assistant, Excel Assistant Need somebody to duplicate/creat...

Excel Assistant Need somebody to duplicate/create an excel spreadsheet and to make it website friendly. Desired Skills are VB.NET, VBA, C++, macros, webdesign

How can you add rows from the datatable object of dataset, How can you add ...

How can you add or remove rows from the DataTable object of DataSet? The DataRowCollection class explains the collection of rows for the DataTable object in a DataSet. The Data

Explain the diffrent type of literals in c#, Explain the diffrent type of l...

Explain the diffrent type of literals in c# The different types of literals in C# are: Boolean literals - Refers to the True and False literals that map to the true and fals

Describe the services that uddi provides to web applications, Describe the ...

Describe the services that UDDI provides to Web applications. UDDI gives the following types of services to a Web application: XML Schema for business descriptions - Contain

Backend solution up integrate it with the frontend, Project Description: ...

Project Description: System is used for tracking company's activities through several projects by keeping track of incomes and expenses per project. This project is fairly ea

What is common language specification, What is Common Language Specificatio...

What is Common Language Specification (CLS)? CLS is a set of essential rules, which must be followed by each .NET language to be a .NET- compliant language. It enables interope

Difference between "web farms" and "web garden", What is the difference bet...

What is the difference between "Web farms" and "Web garden"? The "Web farms" are used to have some redundancy to reduce the failures. It consists of two or more web server of t

Define the tooltip control, Define the ToolTip control. How can you associa...

Define the ToolTip control. How can you associate it with other controls? The ToolTip control produces a small pop-up window with explanatory text for an element it is displaye

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd