Click here to Skip to main content
16,017,373 members

Comments by RIPSolution (Top 3 by date)

RIPSolution 9-Oct-14 8:46am View    
How do you know that textBoxID.Select(); is not executing? Probably you are just looking for cursor inside that textbox, right? But keep in mind you have other code down in the finally block which also sets the focus on textBoxPlace, if its empty. So even though earlier you selected textBoxID, the focus will stay on textBoxPlace if its empty.
No code in finally block will be ignored unless you tell compiler to do so (by putting decision making statements)
Hope this helps!
RIPSolution 8-Oct-14 23:21pm View    
Well there you go. The tablename "User" is conflicting with the predefined User keyword of SQL server and hence its throwing error. Put your table name in square brackets in the Insert statement and it should work.

SqlCommand cmd = new SqlCommand("INSERT INTO [User](Username,Password,Firstname,MiddleInitial,Lastname,Age,Phone,Address,City,State,Email) VALUES(@user,@pass,@first,@middle,@last,@age,@phone,@add,@city,@state,@email)",con);
RIPSolution 8-Oct-14 22:37pm View    
So whats the message you are getting as the part of SQLException? Can you copy and paste the message or stack trace?