Trouble with sqlCommand

E

Eduardo Rosa

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
 
M

Michael C

Change this line:

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

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

That's it.
 
E

Eduardo Rosa

that's so basic, I feel shame.
thanks a lot




Michael C said:
Change this line:

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

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

That's it.
 
M

Michael C

Trust me, we've all been there, done that :) Sometimes you just need a
fresh pair of eyes to scan it for you :)

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top