Drag and Drop functionalities and Wizards are just additional rapid application development features given by Visual Studio.Net, all ADO.NET objects are available in code also and interanally VS.NET generates coding for various procedures created by Wizards.
Here i am showing manual way to implement database, i am using OLEDB classes which can be replaced by SQL calsses also:
Code:
Imports System.Data
' For Microsoft SQL Server database connections.
Imports System.Data.SqlClient
' For Oracle database connections.
Imports System.Data.OracleClient
' For other database connections.
Imports System.Data.OleDb
Code:
' (1) Create the data connection.
Dim ContactMgmt As New SqlConnection ("server=(local);database=Contacts;Trusted_Connection=yes")
' (2) Create a data adapter.
m_adptContactMgmt = New SqlDataAdapter("select * from Contacts", ContactMgmt)
' (3) Create a data set.
Dim dsContacts As New DataSet
' (4) Fill the data set.
m_adptContactMgmt.Fill(dsContacts, "Contacts")
' (5) Display the table in a data grid using data binding.
DataGrid1.DataSource = dsContacts.Tables("Contacts").DefaultView
DataGrid1.DataBind()
Like this you can implement any database related operation through coding although it takes time but it will highly increase the flexibility and undersating of your code.
GMike
"I would love to change the world, but they won't give me the source code."
Enter your message below
Sign in or Join us (it's free).