Showing posts with label byval. Show all posts
Showing posts with label byval. Show all posts

Friday, March 16, 2012

Please help me with this error

"Reference to object nonestablished like instance of an object"

this error is show when the debbuger pass over here:

Sub Buscar_Click(ByVal sender As Object, ByVal e As EventArgs)

Dim webd As New NewHost (this is a WebForm called "NewHost")
Dim str As String = Find.Text
Dim cmd As SqlCommand
cmd = New SqlCommand("Select host.* from host inner join people on host.codcli=people.codcli where people.name='" & str & "'", webd.SqlConnection1)

webd.SqlAdDominio.SelectCommand = cmd (HERE IS THE ERROR)

webd.SqlAdDominio.Fill(webd.DS.PEOPLE)
Response.Redirect("NewHost.aspx?sw=false")

End SubJust a guess, but do you have a "New()" sub defined in NewHost that instantiates all your objects, like SqlAdDominio.
i check that and i deleted de "new" word from "Dim webd As New NewHost".
but now the problem is one line before :

"cmd = New SqlCommand("Select dominio.* from dominio inner join cliente on dominio.codcli=cliente.codcli where cliente.nombre='" & str & "'", webd.SqlConnection1)"

and the error is the same. "Reference to an object nonestablished like instance of an object."