Friday 29 April 2016

Insert Database and create a connection with database in Asp.Net with VB.Net

How to Insert Database In Asp.Net with VB.Net Step?


1). First Open the visual Studio 2008.














2). Click on Website and Select “ASP.NET Web Site” and Select a “VisualBasic.Net”Language and Set the Location and Press “ OK ”.













3).  Open "Solution Exporer" and Select Website and right click and Add New Item.


4). Select “SQL Server Database” Change a Database Name and Press Add Button.















 5). Click On Yes button.
6). Open “Server Explorer” You can see the Database.

















7). Right Click and a “Add New Table”.















8). Set the “Column name ”, “Datatype” and “Allow Nulls” and press CTRL+S and set the Table name and Press “OK” button. 















9). You can see the table in “Server Exporer”












=> This method and import class is used to create a connection with DATABSE.
we can use a Imports System.Data.SqlClient name space for sql database.
we can use a Imports System.Data.OleDb name space for Oledb database.
we can use a Imports System.Data.Odbc name space for ODBC database.

we can create a connection object for establish a connection of database.

Coading 

Imports System.Data.SqlClient
 Public Function con()
        Dim cn As New SqlConnection(ConfigurationManager.ConnectionStrings(1).ConnectionString)
        cn.Open()

    End Function

in this coading the database connection is set a connetion string dynamic.

No comments:

Post a Comment