This article is might be useful for beginers to learn how to bind controls with Dataset using Wizards. here I am trying to mention an easy and details embedding step by step wizard process to bind textbox control with BndingNavigator to database.
DataBinding is the process to binding a control, such as a TextBox or a label, to a single value in a dataset. The dataset value can be bound to the control by using the properties of the control. for example you can bind the value of a column in the dataset to a TextBox control by setting the Text property under the DataBinding category of the TextBox control.
here In this article I am going to bind a some column of Contact Table from AdventureWorks database to TextBox Control.
Design a Windows Form
Take a look to below images to learn how to Design Images.
In first Image You will see Six Label values and Six TextBox and one BindingNavigator and one BindingSource.
You need to drag all controls from Toolbox and then name it as appropriate values.
After Designing Form You need to navigate the properties of bindingSource1. at Properties window of bindingSource1 you need to Click on "Add project Data Source" as show in 1st Image.
At second step you will see "Data Source Configuration Wizard"
Click on Dataset to get access of SQL Database.
and then Click on DataSet and the Click on Next button
Select DataSource from Change Data Source Window and press OK button.
Click on The New Connection button the New Connection in the Choose Your Data Configuration page. The Add Connection dialog box appears as shown in the following Image.
In "Add Connection" dialog box, you need to perform the following steps :
a) Select the Server name
b) Select the "Use SQL Server Authentication" from Log on to the Server pass
c) Enter the UserName as sa and Password as "YourPassword"
d) Select the Database name as "AdventureWorks" from the Select or enter a database name drop down list.
Click the Test Connection. if every thing is OK then A message will Displayed with text Test Connection Succeeded. as given in below Image
and then check yes radio button in "Data Source Configuration Wizard"
Click the Next button. the "Save the Connection String to the Application Configuration file" page is displayed
Click the Next Button which will display the "Choose your Database Object" page in which you need expand Tables node and Select Table name with appropriate values.
Slect Database Object values. here Selecting Column Field of Table(Contact)
and then at last Click on Finish button.
Now you need to perform given steps to bind textbox with DataSet
its better to see below animated Image which will guide you how to bind Column Field with appropriate TextBox Control.
at last You need to bind BindingNaviagator to DataSource as given below
Now run Application. running application will look like as Given below
Database used in this article is :- AdventureWorks Database
and Table used is :- Contact Table.