Steps:-
1.file>new >project>Visual Basic
2.Asp.net Web application
3.Empty and tick web Forms
4.go to solution exp and rightclick webapplication1
and add>new item>search master page>web forms master page(2)
add it.
5.click site1.master go to source at h1 tag between the form and div tag
name it according to your requirement
6.go design part take it center and add image button and copy the image to your vb folder
7.go image button properties>imageurl select your image
8.then search menu from toolbox and >properties>layout/orientation>horizontal give padding in staticmenuitemstyle
9.click menu arrow>edit menu items>edit text >+button>edit text according to your requirement.
10.properties>staticmenustyle>change colour.
11.design it accornding to image
12.click site1.master and add content page and rename it according
to your requirement
13.rename it to login.aspx go to design part and design it
14.view>sql server obj exp>(localdb)>databases rightclick>add new database>name it>right click on tables>
15.update it.
16.copy the server from dbo.park properties ex-(localdb)\MSSQLLocalDB
16.take datagridview>arrow>choose data source>new data source>Sql data base>new connection>paste it on server name>select db >test connection
17.copy connection string
ex-Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=park;Integrated Security=True
18.dbl click login button >remove all the code>paste it
Imports System.Data.SqlClient
Imports System.Data
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim Con As New SqlConnection
Dim Cmd As New SqlCommand
Con.ConnectionString = "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=park;Integrated Security=True"
Con.Open()
Cmd = New SqlCommand("INSERT INTO park values('" & TextBox1.Text & "','" & TextBox2.Text & "')", Con)
Cmd.ExecuteNonQuery()
Con.Close()
MsgBox("inserted")
End Sub
End Class
19.add content page rename it search
20.dbl click search button and remove all the code
Imports System.Data.SqlClient
Imports System.Data
Imports System.Data.SqlClient.SqlException
Public Class WebForm3
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim Con As New SqlConnection
Dim Cmd As New SqlCommand
Dim Dr As SqlDataReader
Con.ConnectionString = "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=park;Integrated Security=True"
Con.Open()
Cmd = New SqlCommand("select * from park where id=" + TextBox3.Text + "", Con)
Dr = Cmd.ExecuteReader
If Dr.Read Then
TextBox1.Text = Dr.GetValue(0)
TextBox2.Text = Dr.GetValue(1)
Else
MsgBox("record nhi hai")
End If
Con.Close()
End Sub
Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim Con As New SqlConnection
Dim Cmd As New SqlCommand
Con.ConnectionString = "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=park;Integrated Security=True"
Cmd.Connection = Con
Con.Open()
Cmd.CommandText = "update park set name = '" & TextBox2.Text & "'where id='" & TextBox3.Text & "'"
Cmd.ExecuteNonQuery()
MsgBox("hogaya update")
TextBox1.Text = ""
TextBox2.Text = ""
End Sub
Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim Con As New SqlConnection
Dim Cmd As New SqlCommand
Con.ConnectionString = "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=park;Integrated Security=True"
Cmd.Connection = Con
Con.Open()
Cmd.CommandText = "Delete from park where id = '" & TextBox3.Text & "'"
Cmd.ExecuteNonQuery()
MsgBox("hogaya delete")
TextBox1.Text = ""
TextBox2.Text = ""
End Sub
End Class
21.add content page from site1.master rename it to display
then add button and grid view
22.double click on button and remove all the code and pasteit.
Imports System.Data.SqlClient
Imports System.Data
Public Class WebForm2
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim Con As New SqlConnection
Dim Cmd As New SqlCommand
Con.ConnectionString = "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=park;Integrated Security=True"
Con.Open()
Cmd.CommandText = "select * from park"
Cmd.Connection = Con
GridView1.DataSource = Cmd.ExecuteReader
GridView1.DataBind()
End Sub
End Class
FOR MENU LINK:-
23.go to site1.master and click menu >edit menu items>login>navigate url according to file name do the same process with home search and display.





Comments
Post a Comment