By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,587 Members | 1,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,587 IT Pros & Developers. It's quick & easy.

Trouble with sqlCommand

P: n/a
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


Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Change this line:

SqlCommand.CommandType = System.Data.CommandType.StoredProcedure;

to sqlComm.CommandType = System.Data.CommandType.StoredProcedure;

That's it.
"Eduardo Rosa" <ed*****@clas.com.br> wrote in message
news:%2****************@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

Nov 19 '05 #2

P: n/a
that's so basic, I feel shame.
thanks a lot


"Michael C" <me@mine.com> escreveu na mensagem
news:es**************@TK2MSFTNGP09.phx.gbl...
Change this line:

SqlCommand.CommandType = System.Data.CommandType.StoredProcedure;

to sqlComm.CommandType = System.Data.CommandType.StoredProcedure;

That's it.
"Eduardo Rosa" <ed*****@clas.com.br> wrote in message
news:%2****************@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


Nov 19 '05 #3

P: n/a
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" <ed*****@clas.com.br> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
that's so basic, I feel shame.
thanks a lot


"Michael C" <me@mine.com> escreveu na mensagem
news:es**************@TK2MSFTNGP09.phx.gbl...
Change this line:

SqlCommand.CommandType = System.Data.CommandType.StoredProcedure;

to sqlComm.CommandType = System.Data.CommandType.StoredProcedure;

That's it.
"Eduardo Rosa" <ed*****@clas.com.br> wrote in message
news:%2****************@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



Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.