|
-
Aug 2nd, 2005, 09:25 PM
#1
Thread Starter
Fanatic Member
advise about static in c#
pls take a look the class below. I just want to ask some advise from anyone
about this class if it is good or have some other way to do this.
pls give me advice.
public class SelectTable
{
public static SqlDataReader loginuser(string par1)
{
SqlCommand cmd =new SqlCommand();
cmd.Connection =stsqcon.getConnection();
cmd.CommandText = "Select top 1 * From users where login =@login";
cmd.Parameters.Add("@login",SqlDbType.NChar ,10);
cmd.Parameters["@login"].Value =par1;
cmd.CommandType = CommandType.Text;
SqlDataReader dreader = cmd.ExecuteReader(CommandBehavior.SingleResult);
return dreader;
}
}
popskie
-
Aug 3rd, 2005, 01:04 AM
#2
Re: advise about static in c#
Without seeing what else the class contains I couldn't say for sure but it seems inappropriate to me. I wouldn't expect a function called LoginUser to return an SqlDataReader. I would expect it to return a bool indicating whether the login was successful or not. I would think that this would be a method of your login form rather than some specific class, although I don't know what else the class contains. I also think SelectTable seems like an odd class name.
-
Aug 3rd, 2005, 02:14 AM
#3
Thread Starter
Fanatic Member
Re: advise about static in c#
pk thank u very much for the comment.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|