Connection property has not been initialized
Hi,to everyone
What i want about this is In first form there is one search button.When i enter the data and click the search button it goes to the second form.In second form there is only one DataGrid.
When i click that button it goes to the database and retrieve the data from database and shows only that particular details only.so plz.. help me.
Is there any modifications in that plz modify and send me .......plz.
This is code in one form:
Imports System.Data
Imports System.Data.OleDb
Public Class tracknumber
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub btntrack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btntrack.Click
Dim con As New OleDbConnection(ConfigurationSettings.AppSettings( "connectionstring"))
Dim tracknumber As Integer
con.Open()
Dim cmd As New OleDbCommand
cmd.Connection = con
Response.Redirect("database.aspx")
con.Close()
End Sub
End Class
This the code in second form:
Imports System.Data.OleDb
Public Class database
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim con As New OleDbConnection(ConfigurationSettings.AppSettings( "connectionstring"))
Dim TrackNumber As Integer
Dim cmd As New OleDbCommand("select * from track where TrackNumber='" & Request.QueryString("TrackNumber") & " ' ", con)
con.Open()
DataGrid1.DataSource = cmd.ExecuteReader()
DataGrid1.DataBind()
con.Close()
End Sub
End Class
|