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

Describe in biref about object-oriented programming, What is object-oriente...

What is object-oriented programming (OOP)? OOP is a method to develop logical modules, such as classes that contain properties, methods, fields, and events. An object is formed

I require to syn my microsoft exchange calendar, Google Calendar Project...

Google Calendar Project Description: I require to syn my Microsoft exchange calendar with the Google calendar so i will view the all the changes that happen in Microsoft exch

Customer management project, This is a Customer Management project. Custome...

This is a Customer Management project. Customer data is offered in a text file. The program may load this text data into its database columns. The data mapping is user definable. U

Asp.net 2.0 application port to asp.net mvc, ASP.NET 2.0 application port t...

ASP.NET 2.0 application port to ASP.NET MVC Project Description: Legacy ASP.NET application for managing tasks for a private client needs a complete re-write. The applicat

Difference between the select clause and selectmany method, What is the dif...

What is the difference between the Select clause and SelectMany() method in LINQ? Both the Select clause and SelectMany() method are used to produce a result value from a sourc

Live chat similar to alibaba seller or buyer chat, Live Chat Similar to Ali...

Live Chat Similar to Alibaba seller/ buyer chat Project Description: I want someone to design and implement for us a live chat program that will be used on our ecommerce webs

Whatsapp bulk messaging, Project Description: We require working system ...

Project Description: We require working system to send message in bulk to whats-app numbers without getting blocked. Multiple senders can be used. Skills required: .NET, P

I need automatic rate processing, Project Description: PURPOSE Xconne...

Project Description: PURPOSE Xconnect needs a fully automated system for receiving and processing Terminator cost sheets based on set business principle, convert the accepted

Consuming a web service with soap on c# .net, Consuming a web service with ...

Consuming a web service with SOAP on c# .NET Project Description: I need to consume a web service with SOAP. I have xml file and some description. I need it to be done

Read an array and perform sorting - c# program, Read an Array and perform S...

Read an Array and perform Sorting - C# program Can any one assist me in performing sorting of an array.

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