• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 421
  • Last Modified:

LogonUser WebMethod

(This is the last conversion question - I promise.)

I have one more small block of code that I wasn't able to convert using C-Sharpener. I'm not including my partial conversion, since it will just make things messier. My version uses a SQL database instead of Access.

[ WebMethod() ]
        public int LogonUser() {
            int logonUserReturn = 0;
            if ( !( objConn.State == 1 ) ) { objConn.Open( strConnection, "", "", -1 ); }
            Object strUID = UniqueID();
            try {
                objRS = objConn.Execute( "INSERT INTO users (password,uniqueid) VALUES ('" + strUID + "', '" + strUID + "')", out null, -1 );
                objRS = objConn.Execute( "SELECT userid FROM users WHERE uniqueid='" + strUID + "'", out null, -1 );
                logonUserReturn = Int( objRS( 0 ).Value );
                objRS = null;
            }
            catch  {
                logonUserReturn = 0;
            }
            objConn.Close();
            return logonUserReturn;
        }

Sorry if this is an obvious question, I've been at this for a long time, and simply can't think straight any more. My main problems have been with the connection string. I'm also not sure why there is an out parameter being passed to the Execute method. (It would have helped if the source I'm converting was documented.)

Once I'm done, I'm takng a remedial course in VB.NET.
0
nh_capricorn
Asked:
nh_capricorn
1 Solution
 
PerlChaserCommented:
I'm not sure exactly what your question is, but I'm pretty sure you can't have a parameter with a space in it (out null).  I don't see your connection string.  Is it there, and I'm just a moron?

~PerlChaser~
0
 
Bob LearnedCommented:
Are you converting from VB.NET to C#?  Or, the other way around?

Do you have the original code converted from?  Or, is this the original?

Bob
0
 
nh_capricornAuthor Commented:
You were right. Parameters cannot have spaces in them.

I am sorry that it took me this long to award you the points you earned. Guess I spaced it.

Thanks again for your help.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now