Tuesday, March 13, 2012

Trouble with sqlCommand

I can't undertand why that's don't works, can somebody help me?
thanks a lot
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: CS0120: An object reference is required for the
nonstatic field, method, or property
'System.Data.SqlClient.SqlCommand.CommandType'
Source Error:
Line 1: bool ValidateUser(string strLogin, string strPassword, int nLevel,
SqlConnection sqlConn){
Line 2: SqlCommand sqlComm = new SqlCommand("spValidateUser", sqlConn);
Line 3: SqlCommand.CommandType = System.Data.CommandType.StoredProcedure;
Line 4:
Line 5: SqlParameter sqlParamLogin = new SqlParameter("@dotnet.itags.org.Usuario",
System.Data.SqlDbType.VarChar);
Source File: C:\Meus DOC\Sites\Loja Virtual .NET\www\library\functions.cs
Line: 3Change this line:
SqlCommand.CommandType = System.Data.CommandType.StoredProcedure;
to sqlComm.CommandType = System.Data.CommandType.StoredProcedure;
That's it.
"Eduardo Rosa" <eduardo@.clas.com.br> wrote in message
news:%23XKeuVL$EHA.1264@.TK2MSFTNGP12.phx.gbl...
> I can't undertand why that's don't works, can somebody help me?
> thanks a lot
>
> Description: An error occurred during the compilation of a resource
required
> to service this request. Please review the following specific error
details
> and modify your source code appropriately.
> Compiler Error Message: CS0120: An object reference is required for the
> nonstatic field, method, or property
> 'System.Data.SqlClient.SqlCommand.CommandType'
> Source Error:
>
> Line 1: bool ValidateUser(string strLogin, string strPassword, int
nLevel,
> SqlConnection sqlConn){
> Line 2: SqlCommand sqlComm = new SqlCommand("spValidateUser", sqlConn);
> Line 3: SqlCommand.CommandType = System.Data.CommandType.StoredProcedure;
> Line 4:
> Line 5: SqlParameter sqlParamLogin = new SqlParameter("@.Usuario",
> System.Data.SqlDbType.VarChar);
> Source File: C:\Meus DOC\Sites\Loja Virtual .NET\www\library\functions.cs
> Line: 3
>
>
that's so basic, I feel shame.
thanks a lot
"Michael C" <me@.mine.com> escreveu na mensagem
news:es4SWlL$EHA.1524@.TK2MSFTNGP09.phx.gbl...
> Change this line:
> SqlCommand.CommandType = System.Data.CommandType.StoredProcedure;
> to sqlComm.CommandType = System.Data.CommandType.StoredProcedure;
> That's it.
>
> "Eduardo Rosa" <eduardo@.clas.com.br> wrote in message
> news:%23XKeuVL$EHA.1264@.TK2MSFTNGP12.phx.gbl...
> required
> details
> nLevel,
>
Trust me, we've all been there, done that :) Sometimes you just need a
fresh pair of eyes to scan it for you :)
Thanks
"Eduardo Rosa" <eduardo@.clas.com.br> wrote in message
news:%23RTy5SM$EHA.3336@.TK2MSFTNGP11.phx.gbl...
> that's so basic, I feel shame.
> thanks a lot
>
>
> "Michael C" <me@.mine.com> escreveu na mensagem
> news:es4SWlL$EHA.1524@.TK2MSFTNGP09.phx.gbl...
sqlConn);
.NET\www\library\functions.cs
>

0 comments:

Post a Comment