473,505 Members | 15,036 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("@Usuario",
System.Data.SqlDbType.VarChar);

Source File: C:\Meus DOC\Sites\Loja Virtual .NET\www\library\functions.cs
Line: 3


Nov 19 '05 #1
3 1312
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1173
by: adam | last post by:
Hi there I've got a littel problem. I've samo form which should add data to database. Everythinks goes OK, but I'd like to have some alert messege when samobody would like to add another user with...
14
2346
by: aroraamit81 | last post by:
Hi, I am facing a trouble. I have some Session variables in my code and somehow my session variables are getting mixed up with other users. For example User A has access to 10 companies and...
2
1641
by: allfyre | last post by:
Ok, to make a long story short, I'm Emitting some MSIL from a c# application. I know that THIS is the MSIL I want to be emitting: //**************************************************************...
2
1399
by: rcoco | last post by:
I'm having an error message sounding like : Prepared statement '(@id text)SELECT * from isp_email.staff where @id like +txtname.' expects parameter @id, which was not supplied. This message appear...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5028
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.