PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Connection property has not been initialized
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Connection property has not been initialized
![]() |
Connection property has not been initialized |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Imports System.Data.sqlclient
Public Class track 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 sqlConnection(ConfigurationSettings.AppSettings("connectionstring")) Dim tracknumber As Integer con.Open() Dim cmd As New sqlCommand cmd.Connection = con Response.Redirect("database.aspx") con.Close() End Sub End Class Actually what i want in this means in first form there is one search button.When i click that button it goes to the database page and shows the details of that particular number.In this i put only datagrid.Can u help me how to collect the data from database?plz..................... Imports System.Data.sqlclient 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 TrackNumber = CStr(Request.QueryString("TrackNumber")) Convert.ToString("TrackNumber") 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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Looks to me like the 'connectionstring' app settings is either not there, or
it is blank. I'm sure you could have figured this out if you had stepped through the code and looked for its value. <sasi.vempalli@gmail.com> wrote in message news:1158648890.004548.251980@m7g2000cwm.googlegroups.com... > Imports System.Data.sqlclient > Public Class track > 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 > sqlConnection(ConfigurationSettings.AppSettings("connectionstring")) > Dim tracknumber As Integer > con.Open() > Dim cmd As New sqlCommand > cmd.Connection = con > Response.Redirect("database.aspx") > con.Close() > End Sub > End Class > > Actually what i want in this means in first form there is one search > button.When i click that button it goes to the database page and shows > the details of that particular number.In this i put only datagrid.Can u > help me how to collect the data from database?plz..................... > > > > Imports System.Data.sqlclient > > 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 > TrackNumber = CStr(Request.QueryString("TrackNumber")) > Convert.ToString("TrackNumber") > 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 > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

