Showing posts with label object. Show all posts
Showing posts with label object. Show all posts

Thursday, March 29, 2012

Please Explain

Hi All

Can anyone help me in understanding the highlighted text please.

For Each row As DataRow In ds.Tables(0).Rows
Dim arr() As Object = row.ItemArray()
For i As Integer = 0 To arr.Length - 1


If arr(i).ToString().IndexOf(",") > 0 Then ' I m unable to get this line of code.


record = record & Chr(34) & arr(i).ToString() & Chr(34) & ","
Else
record = record & arr(i).ToString() & ","
End If
Next
body = body & record.Substring(0, record.Length - 1) & vbCrLf
record = ""
Next

Thanks

Asif Ali.

take the object in Array arr at position indicated by i

convert to a string

find the index (position) of a comma character

see if the comma occurred after the first character position


Hi there

Fantastic explanation..

Thanks Again

Asif.

Saturday, March 24, 2012

Please help ! Problem about HttpWebRequest - GetResponse()

Hi,
The problem is that your proxy is not allowing the webrequest.
Do one thing create a webproxy object with your proxy name and port and
bind it to webrequest like this.
// True is to by pass proxy for local
WebProxy proxy = new WebProxy(name:port, true);
// suppose req is HttpWebRequest object
req.Proxy = proxy;
and then user req.getResponse method to get the response.
Regards,
AngrezHi singh_angrez,
Thank you for your suggestion. But I can test it in next 2 day after this
wend. After I try I will report the result again if it can solve my
problem or not
Thank you very much
Jap.
Hi singh_angrez,
Before I try your suggestion. I wanna show you about my code.
And my server architecture is like this
Web server --httprequest call to --> My service server
Actually, If my service server reponse the result to me in a short time,
everything is ok..no exception. But anytime my service server take long
time to process and send me the result.. at that time if there are many
requests from web server call to my service server, I got that exception
until my service server have a good response.
This is my code now. May be my code is not correct about HttpWebRequest
property.
//==== set ssl connection ==
ServicePointManager.CertificatePolicy = new MyPolicy();
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create
(PAYMENTGATEWAY_URL+strParam.ToString());
objRequest.Method = "GET";
//==== add new code ==
objRequest.KeepAlive = false;
objRequest.ProtocolVersion=HttpVersion.Version10;
objRequest.Proxy = System.Net.WebProxy.GetDefaultProxy(); // I use
default proxy which work well in normal time.
objRequest.AllowAutoRedirect=true;
objRequest.MaximumAutomaticRedirections=10;
objRequest.Timeout = (int) new TimeSpan(0,0,HTTPTIMEOUT)
.TotalMilliseconds; // ,HTTPTIMEOUT = 300
objRequest.UserAgent="Mozilla/3.0 (compatible; My Browser/1.0)";
//==== add new code ==
string str = null;
HttpWebResponse objResponse;
StreamReader sr = null;
try
{
objResponse = (HttpWebResponse)objRequest.GetResponse();
}
catch( Exception e)
{
EventMgmt.EventExceptionMsg("Payment Gateway-GetResponse() =>
"+e.ToString(), @."\DataAccess\PGWException");
throw new ServiceException("PGW001","HOST_UNREACHABLE",e);
}
try
{
sr = new StreamReader(objResponse.GetResponseStream());
str = sr.ReadToEnd().Replace('\n'.ToString(),"").Replace('\t'.ToString()
,"").Replace('&'.ToString(),"");
}
catch( Exception e)
{
EventMgmt.EventExceptionMsg("Payment Gateway-ReadResponseStream() =>
"+e.ToString(), @."\DataAccess\PGWException");
throw new ServiceException("PGW003","READ_STREAM_ERROR",e);
}
finally
{
if( sr != null)
sr.Close();
objResponse.Close();
}
Thank you,
Jap.
the default setting for webclient is to only allow two connections to a
remote server. if you calls are slow, and they stack up, you will have
timeout problems. also you could hit your max thread pool sizes.
try upping the number of connections.
(httpRequest.ServicePoint.ConnectionLimit)
-- bruce (sqlwork.com)
"japslam japslam via webservertalk.com" <forum@.webservertalk.com> wrote in
message news:1b2e8e50a4a5493bbb9004d9c3d2c1f0@.Do
webservertalk.com...
> Hi singh_angrez,
>
> Before I try your suggestion. I wanna show you about my code.
> And my server architecture is like this
> Web server --httprequest call to --> My service server
> Actually, If my service server reponse the result to me in a short time,
> everything is ok..no exception. But anytime my service server take long
> time to process and send me the result.. at that time if there are many
> requests from web server call to my service server, I got that exception
> until my service server have a good response.
> This is my code now. May be my code is not correct about HttpWebRequest
> property.
>
> //==== set ssl connection ==
> ServicePointManager.CertificatePolicy = new MyPolicy();
> HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create
> (PAYMENTGATEWAY_URL+strParam.ToString());
> objRequest.Method = "GET";
> //==== add new code ==
> objRequest.KeepAlive = false;
> objRequest.ProtocolVersion=HttpVersion.Version10;
> objRequest.Proxy = System.Net.WebProxy.GetDefaultProxy(); // I use
> default proxy which work well in normal time.
> objRequest.AllowAutoRedirect=true;
> objRequest.MaximumAutomaticRedirections=10;
> objRequest.Timeout = (int) new TimeSpan(0,0,HTTPTIMEOUT)
> .TotalMilliseconds; // ,HTTPTIMEOUT = 300
> objRequest.UserAgent="Mozilla/3.0 (compatible; My Browser/1.0)";
> //==== add new code ==
> string str = null;
> HttpWebResponse objResponse;
> StreamReader sr = null;
> try
> {
> objResponse = (HttpWebResponse)objRequest.GetResponse();
> }
> catch( Exception e)
> {
> EventMgmt.EventExceptionMsg("Payment Gateway-GetResponse() =>
> "+e.ToString(), @."\DataAccess\PGWException");
> throw new ServiceException("PGW001","HOST_UNREACHABLE",e);
> }
> try
> {
> sr = new StreamReader(objResponse.GetResponseStream());
> str = sr.ReadToEnd().Replace('\n'.ToString(),"").Replace('\t'.ToString()
> ,"").Replace('&'.ToString(),"");
> }
> catch( Exception e)
> {
> EventMgmt.EventExceptionMsg("Payment Gateway-ReadResponseStream() =>
> "+e.ToString(), @."\DataAccess\PGWException");
> throw new ServiceException("PGW003","READ_STREAM_ERROR",e);
> }
> finally
> {
> if( sr != null)
> sr.Close();
> objResponse.Close();
> }
>
> Thank you,
> Jap.

Please help ! Server Error in Application ! Object variable or

Hi,

One urgent issue in ASP.Net.

We have hosted an asp.net application in a windows 2003 server machine. The
application runs well but ONCE IN A WHILE it comes up with the error, "Server
Error in '/CreditApplication' Application."
The error details are given below.

Sometimes, when we call the URL, it takes a long to load and finally doesnt
load and comes up with this error.

I dont understand why it works some time and doesnt work at other times.

The line in which the error is shown is a function, the contents of which
are given below.

*------------

Private Sub LocContracts()
Dim OnlineConnection As New OnlineConnection
Dim Sql, SqlComm, SqlDR

Dim Branch = "ABHN"

Dim DBConnection = OnlineConnection.OnlineDBConnection
(Database)
Dim Trans As SqlClient.SqlTransaction =
DBConnection.BeginTransaction(IsolationLevel.ReadC ommitted)
Sql = "Update Applications Set ContractType = 5,Repayment =
Case "
Sql = Sql & " when (LoanAmount * 3 / 100) > 40 Then
(LoanAmount * 3 /100)"
Sql = Sql & " else 40 End "
Sql = Sql & " where BranchId in ( Select BranchId from Branch
where BranchName = '" & Branch & "')"
Sql = Sql & " And ContractType = 0"

SqlComm = New SqlCommand(Sql, DBConnection)
SqlComm.Transaction = Trans
SqlDR = SqlComm.ExecuteReader()
Trans.Commit()

SqlDR.Close()
SqlComm = Nothing
Sql = Nothing
OnlineConnection = Nothing

End Sub

*------------

I was wondering if it has anything to do with "isolationlevel.readcommitted"

The error message is given below

*------------

Server Error in '/CreditApplication' Application.
________________________________________
Object variable or With block variable not set.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object variable or With
block variable not set.

Source Error:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object variable or With block variable not set.]

Microsoft.VisualBasic.CompilerServices.LateBinding .LateGet(Object o, Type
objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
+934

Extraction.ViewApplication.LocContracts() in
D:\CreditApplication-1.0H\ViewApplication\ViewApplicationExtraction.asp x.vb:396

Extraction.ViewApplication.Page_Load(Object sender, EventArgs e) in
D:\CreditApplication-1.0H\ViewApplication\ViewApplicationExtraction.asp x.vb:54

System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750
________________________________________
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET
Version:1.1.4322.2300

*------------

Any help would be really appreciated.
Many ThanksWhich line is 396 in your code? It's attempting to use a NULL object
somewhere. Possibly the database connection failed in
OnlineDBConnection. If this is production code, you should add some
exception handling and logging for the DB connection and execution
calls.

Also, why use a DataReader to execute an Update statement? An
ExecuteNonQuery() seems more appropriate in this case.

-Carl
Hi Carl,

Thanks very much for your reply.
I have updated my code with ExecuteNonquery().

Line 396 in my code is given below

Dim Trans As SqlClient.SqlTransaction =
DBConnection.BeginTransaction(IsolationLevel.ReadC ommitted)

As given in my post, iam getting this error only once in a while which is
really confusing me.

Regards,
Majo

"carl" wrote:

> Which line is 396 in your code? It's attempting to use a NULL object
> somewhere. Possibly the database connection failed in
> OnlineDBConnection. If this is production code, you should add some
> exception handling and logging for the DB connection and execution
> calls.
> Also, why use a DataReader to execute an Update statement? An
> ExecuteNonQuery() seems more appropriate in this case.
> -Carl
>
> We have hosted an asp.net application in a windows 2003 server machine. The
> application runs well but ONCE IN A WHILE it comes up with the error, "Server
> Error in '/CreditApplication' Application."
> The error details are given below.

Did you ever resolve this issue? I'm currently experiencing something
similar. An ASP.NET application was running fine on a Windows XP
machine. But now that we've moved it to Windows Server 2003, it
*sometimes* gets the error that you described:

System.NullReferenceException: Object variable or With block variable
not set.
at Microsoft.VisualBasic.CompilerServices.LateBinding .LateGet(Object
o, Type objType, String name, Object[] args, String[] paramnames,
Boolean[] CopyBack)

This is while accessing a COM object. Once again, it's worked
flawlessly on XP for quite a while now, but seems to occasionally have
problems on Windows Server 2003 (maybe the operating system isn't the
main issue, but I don't know what other differences exist).

- Roger
Hi Roger,

I havent solved my problem yet.

I was wondering if it has something to do with database locks. I checked for
any locks, but couldnt find any at the time of the error.

I have no idea how to solve this problem.

Please let me know if you come across any solutions.

Thanks
majo

"rogercnorris@.yahoo.com" wrote:

> > We have hosted an asp.net application in a windows 2003 server machine. The
> > application runs well but ONCE IN A WHILE it comes up with the error, "Server
> > Error in '/CreditApplication' Application."
> > The error details are given below.
> Did you ever resolve this issue? I'm currently experiencing something
> similar. An ASP.NET application was running fine on a Windows XP
> machine. But now that we've moved it to Windows Server 2003, it
> *sometimes* gets the error that you described:
> System.NullReferenceException: Object variable or With block variable
> not set.
> at Microsoft.VisualBasic.CompilerServices.LateBinding .LateGet(Object
> o, Type objType, String name, Object[] args, String[] paramnames,
> Boolean[] CopyBack)
> This is while accessing a COM object. Once again, it's worked
> flawlessly on XP for quite a while now, but seems to occasionally have
> problems on Windows Server 2003 (maybe the operating system isn't the
> main issue, but I don't know what other differences exist).
> - Roger
>
Hi,

This time, I got a new Server Error

"Fill: selectcommand.connection property has not been initialized" in
another asp page. This also comes only ONCE IN A WHILE.

The error is coming in the line with "Fill" in the code given below

*------------
DBConnection = OnlineConn.OnlineDBConnection(Database)

Sql = KeyWord

Dim SqlCommand As New SqlCommand(Sql, DBConnection)
Dim SqlAdapter As New SqlDataAdapter(SqlCommand)
Dim DataSet As New DataSet
SqlAdapter.Fill(DataSet)

*------------

While linking this with my previous error " Object variable with block ... "
, I was wondering if this error has anything to do with the database
connection.

Will this happen if the asp.net page is refreshed frequently ?

Thanks in advance for your help

Rgds,
Majo

"majo" wrote:

> Hi Roger,
> I havent solved my problem yet.
> I was wondering if it has something to do with database locks. I checked for
> any locks, but couldnt find any at the time of the error.
> I have no idea how to solve this problem.
> Please let me know if you come across any solutions.
> Thanks
> majo
>
> "rogercnorris@.yahoo.com" wrote:
> > > We have hosted an asp.net application in a windows 2003 server machine. The
> > > application runs well but ONCE IN A WHILE it comes up with the error, "Server
> > > Error in '/CreditApplication' Application."
> > > The error details are given below.
> > Did you ever resolve this issue? I'm currently experiencing something
> > similar. An ASP.NET application was running fine on a Windows XP
> > machine. But now that we've moved it to Windows Server 2003, it
> > *sometimes* gets the error that you described:
> > System.NullReferenceException: Object variable or With block variable
> > not set.
> > at Microsoft.VisualBasic.CompilerServices.LateBinding .LateGet(Object
> > o, Type objType, String name, Object[] args, String[] paramnames,
> > Boolean[] CopyBack)
> > This is while accessing a COM object. Once again, it's worked
> > flawlessly on XP for quite a while now, but seems to occasionally have
> > problems on Windows Server 2003 (maybe the operating system isn't the
> > main issue, but I don't know what other differences exist).
> > - Roger
Hi,

I created a new virtual directory in IIS and xcopied the whole content
(which is giving me the server error)

Right at the moment when i got the server error in my initial application, i
tried the new application which was created by me and it WORKED WELL.

Does this mean, that this server error has nothing to do with database locks
or IIS ?
I think, it has something to do with concurrent connections.
Can anyone help me with the connection parameters which i should use.

Many thanks...

Please help ! Server Error in Application ! Object variable or

Hi,
One urgent issue in ASP.Net.
We have hosted an asp.net application in a windows 2003 server machine. The
application runs well but ONCE IN A WHILE it comes up with the error, "Serve
r
Error in '/CreditApplication' Application."
The error details are given below.
Sometimes, when we call the URL, it takes a long to load and finally doesnt
load and comes up with this error.
I dont understand why it works some time and doesnt work at other times.
The line in which the error is shown is a function, the contents of which
are given below.
*---
Private Sub LocContracts()
Dim OnlineConnection As New OnlineConnection
Dim Sql, SqlComm, SqlDR
Dim Branch = "ABHN"
Dim DBConnection = OnlineConnection.OnlineDBConnection
(Database)
Dim Trans As SqlClient.SqlTransaction =
DBConnection.BeginTransaction(IsolationLevel.ReadCommitted)
Sql = "Update Applications Set ContractType = 5,Repayment =
Case "
Sql = Sql & " when (LoanAmount * 3 / 100) > 40 Then
(LoanAmount * 3 /100)"
Sql = Sql & " else 40 End "
Sql = Sql & " where BranchId in ( Select BranchId from Branch
where BranchName = '" & Branch & "')"
Sql = Sql & " And ContractType = 0"
SqlComm = New SqlCommand(Sql, DBConnection)
SqlComm.Transaction = Trans
SqlDR = SqlComm.ExecuteReader()
Trans.Commit()
SqlDR.Close()
SqlComm = Nothing
Sql = Nothing
OnlineConnection = Nothing
End Sub
*---
I was wondering if it has anything to do with "isolationlevel.readcommitted"
The error message is given below
*---
Server Error in '/CreditApplication' Application.
________________________________________
Object variable or With block variable not set.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information abou
t
the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object variable or With
block variable not set.
Source Error:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object variable or With block variable not set.]
Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type
objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack
)
+934
Extraction.ViewApplication.LocContracts() in
D:\CreditApplication-1. 0H\ViewApplication\ViewApplicationExtrac
tion.aspx.vb:
396
Extraction.ViewApplication.Page_Load(Object sender, EventArgs e) in
D:\CreditApplication-1. 0H\ViewApplication\ViewApplicationExtrac
tion.aspx.vb:
54
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750
________________________________________
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET
Version:1.1.4322.2300
*---
Any help would be really appreciated.
Many ThanksWhich line is 396 in your code? It's attempting to use a NULL object
somewhere. Possibly the database connection failed in
OnlineDBConnection. If this is production code, you should add some
exception handling and logging for the DB connection and execution
calls.
Also, why use a DataReader to execute an Update statement? An
ExecuteNonQuery() seems more appropriate in this case.
-Carl
> We have hosted an asp.net application in a windows 2003 server machine. The
> application runs well but ONCE IN A WHILE it comes up with the error, "Ser
ver
> Error in '/CreditApplication' Application."
> The error details are given below.
Did you ever resolve this issue? I'm currently experiencing something
similar. An ASP.NET application was running fine on a Windows XP
machine. But now that we've moved it to Windows Server 2003, it
*sometimes* gets the error that you described:
System.NullReferenceException: Object variable or With block variable
not set.
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object
o, Type objType, String name, Object[] args, String[] paramnames,
Boolean[] CopyBack)
This is while accessing a COM object. Once again, it's worked
flawlessly on XP for quite a while now, but seems to occasionally have
problems on Windows Server 2003 (maybe the operating system isn't the
main issue, but I don't know what other differences exist).
- Roger

Please help ! Server Error in Application ! Object variabl

Hi Roger,
I havent solved my problem yet.
I was wondering if it has something to do with database locks. I checked for
any locks, but couldnt find any at the time of the error.
I have no idea how to solve this problem.
Please let me know if you come across any solutions.
Thanks
majo
"rogercnorris@dotnet.itags.org.yahoo.com" wrote:

> Did you ever resolve this issue? I'm currently experiencing something
> similar. An ASP.NET application was running fine on a Windows XP
> machine. But now that we've moved it to Windows Server 2003, it
> *sometimes* gets the error that you described:
> System.NullReferenceException: Object variable or With block variable
> not set.
> at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object
> o, Type objType, String name, Object[] args, String[] paramnames,
> Boolean[] CopyBack)
> This is while accessing a COM object. Once again, it's worked
> flawlessly on XP for quite a while now, but seems to occasionally have
> problems on Windows Server 2003 (maybe the operating system isn't the
> main issue, but I don't know what other differences exist).
> - Roger
>Hi,
This time, I got a new Server Error
"Fill: selectcommand.connection property has not been initialized" in
another asp page. This also comes only ONCE IN A WHILE.
The error is coming in the line with "Fill" in the code given below
*--
DBConnection = OnlineConn.OnlineDBConnection(Database)
Sql = KeyWord
Dim SqlCommand As New SqlCommand(Sql, DBConnection)
Dim SqlAdapter As New SqlDataAdapter(SqlCommand)
Dim DataSet As New DataSet
SqlAdapter.Fill(DataSet)
*--
While linking this with my previous error " Object variable with block ... "
, I was wondering if this error has anything to do with the database
connection.
Will this happen if the asp.net page is refreshed frequently ?
Thanks in advance for your help
Rgds,
Majo
"majo" wrote:
> Hi Roger,
> I havent solved my problem yet.
> I was wondering if it has something to do with database locks. I checked f
or
> any locks, but couldnt find any at the time of the error.
> I have no idea how to solve this problem.
> Please let me know if you come across any solutions.
> Thanks
> majo
>
> "rogercnorris@.yahoo.com" wrote:
>
Hi,
I created a new virtual directory in IIS and xcopied the whole content
(which is giving me the server error)
Right at the moment when i got the server error in my initial application, i
tried the new application which was created by me and it WORKED WELL.
Does this mean, that this server error has nothing to do with database locks
or IIS ?
I think, it has something to do with concurrent connections.
Can anyone help me with the connection parameters which i should use.
Many thanks...

Friday, March 16, 2012

please help me to clear this error

hi, i am working in c# asp.net.

my cs:

public void confirm(Object source,System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.Item.ItemType ==ListItemType.Item//e.Item.ItemType ==ListItemType.AlternatingItem)
{
LinkButton lb=(LinkButton)e.Item.Cells[0].FindControl("btndelete");
lb.Attributes["onclick"]="return(confirm('Confermi?'))";
}

}
i am using this coding to show confirm button while clicking the delete button.
this is my aspx:
<asp:datagrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 160px; POSITION: absolute; TOP: 56px"
runat="server" OnDeleteCommand="cmddelete" DataKeyField="age" OnUpdateCommand="cmdupdate"
OnEditCommand="cmdedit" OnItemDataBound ="confirm" OnCancelCommand="cmdcancel" AutoGenerateColumns="False" OnItemCommand="insert"
ShowFooter="True" HeaderStyle-BackColor="#660033" HeaderStyle-ForeColor="white" BackColor="#660033"
ForeColor="#ffffff">

i did for edit,insert,delete allthe things correctly and works well, then i added this confirm delete, for this confirm i am getting the following error:

Compiler Error Message: CS0123: Method 'sqlserver.WebForm4.confirm(object, System.Web.UI.WebControls.DataGridCommandEventArgs)' does not match delegate 'void System.Web.UI.WebControls.DataGridItemEventHandler(object, System.Web.UI.WebControls.DataGridItemEventArgs)'

so please help me to solve this error,pleaseeeeeeeeeeeeeeeeTry Changing
public void confirm(Object source,System.Web.UI.WebControls.DataGridCommandEventArgs e)
To
public void confirm(Object source,System.Web.UI.WebControls.DataGridItemEventArgs e)
hi ferris, thanks for reply and i did modification as what u said, i am getting error in this,

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

public void confirm(Object source,System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType ==ListItemType.Item||e.Item.ItemType ==ListItemType.AlternatingItem)
{
//LinkButton btn=((LinkButton)e.Item.FindControl("delete"));
//btn.Attributes.Add("onclick","return confirm('Are you sure you want to delete this company?');");
LinkButton lb=(LinkButton)e.Item.Cells[0].FindControl("btndelete");
lb.Attributes["onclick"]="return(confirm('Confermi?'))";
//b.Attributes.Add("onclick","return confirm('Are you sure you want to delete this company?');");
}
}

please help me to rectify this error.
Hi,

Try changing

LinkButton lb=(LinkButton)e.Item.Cells[0].FindControl("btndelete");
lb.Attributes["onclick"]="return(confirm('Confermi?'))";

To

LinkButton lb = (LinkButton)e.Item.FindControl("btnDelete");
lb.Attributes.Add("onclick", "return(confirm('Confermi?'));

hth

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."