Click here to Skip to main content
16,013,642 members
Home / Discussions / C#
   

C#

 
GeneralRe: fingerprints of files Pin
Pete O'Hanlon3-Nov-15 23:35
mvePete O'Hanlon3-Nov-15 23:35 
GeneralRe: fingerprints of files Pin
Nadeem3104-Nov-15 18:59
Nadeem3104-Nov-15 18:59 
GeneralRe: fingerprints of files Pin
Pete O'Hanlon4-Nov-15 21:01
mvePete O'Hanlon4-Nov-15 21:01 
AnswerRe: fingerprints of files Pin
Nadeem3103-Nov-15 19:09
Nadeem3103-Nov-15 19:09 
QuestionArgument Exception was unhandled by user code Pin
Asif Zaffar2-Nov-15 20:37
professionalAsif Zaffar2-Nov-15 20:37 
AnswerRe: Argument Exception was unhandled by user code Pin
OriginalGriff2-Nov-15 21:34
mveOriginalGriff2-Nov-15 21:34 
GeneralRe: Argument Exception was unhandled by user code Pin
Asif Zaffar3-Nov-15 23:24
professionalAsif Zaffar3-Nov-15 23:24 
SuggestionRe: Argument Exception was unhandled by user code Pin
Richard Deeming3-Nov-15 1:55
mveRichard Deeming3-Nov-15 1:55 
Your query is missing the VALUES clause, so the next error you'll get is a SQL syntax error.
SQL
INSERT INTO tbl_reg (name, f_name, m_name, dob, gender, phone, address, class, roll_no, section, user_nm, pswd)
VALUES (@name, @f_name, @m_name, @dob, @gender, @phone, @address, @class, @roll_no, @section, @user_nm, @pswd)


You should wrap your connection and command objects in using blocks to ensure that they are properly disposed of when no longer needed.

You're storing the connection as a class-level field, which is a bad idea. It should be a local variable, created as late as possible, and disposed of as soon as possible.
C#
private static SqlConnection CreateConnection()
{
    string connectionString = WebConfigurationManager.ConnectionStrings["YourConnectionString"].ConnectionString;
    return new SqlConnection(connectionString);
}
...
using (SqlConnection connection = CreateConnection())
using (SqlCommand command = new SqlCommand("...", connection))
{
    ...
}


You seem to be storing passwords in plain text, which is a very bad idea. You should only ever store a salted hash of the user's password:
Secure Password Authentication Explained Simply[^]
Salted Password Hashing - Doing it Right[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


QuestionKeyup event not getting triggerd Pin
Darshan BS2-Nov-15 2:01
Darshan BS2-Nov-15 2:01 
AnswerRe: Keyup event not getting triggerd Pin
Richard Deeming2-Nov-15 2:09
mveRichard Deeming2-Nov-15 2:09 
AnswerRe: Keyup event not getting triggerd Pin
Eddy Vluggen2-Nov-15 2:22
professionalEddy Vluggen2-Nov-15 2:22 
AnswerRe: Keyup event not getting triggerd Pin
BillWoodruff2-Nov-15 4:20
professionalBillWoodruff2-Nov-15 4:20 
QuestionHOW TO MAKE FONT CENTER Pin
Nor Amyliana1-Nov-15 17:50
Nor Amyliana1-Nov-15 17:50 
AnswerRe: HOW TO MAKE FONT CENTER Pin
BillWoodruff1-Nov-15 21:21
professionalBillWoodruff1-Nov-15 21:21 
GeneralRe: HOW TO MAKE FONT CENTER Pin
Nor Amyliana2-Nov-15 5:20
Nor Amyliana2-Nov-15 5:20 
QuestionCSV Downloading and Page Transfer Pin
Renjith Kalarikkal1-Nov-15 1:24
Renjith Kalarikkal1-Nov-15 1:24 
AnswerRe: CSV Downloading and Page Transfer Pin
Richard Deeming2-Nov-15 2:07
mveRichard Deeming2-Nov-15 2:07 
QuestionSystem.Speech.Recognition Pin
Christian 9831-Oct-15 22:21
Christian 9831-Oct-15 22:21 
AnswerRe: System.Speech.Recognition Pin
BillWoodruff31-Oct-15 22:35
professionalBillWoodruff31-Oct-15 22:35 
AnswerRe: System.Speech.Recognition Pin
Sergey Kizyan1-Nov-15 1:06
professionalSergey Kizyan1-Nov-15 1:06 
Questionc # webbrowser Windows Media Player Pin
gitokc31-Oct-15 19:30
gitokc31-Oct-15 19:30 
AnswerRe: c # webbrowser Windows Media Player Pin
Pete O'Hanlon31-Oct-15 20:43
mvePete O'Hanlon31-Oct-15 20:43 
AnswerRe: c # webbrowser Windows Media Player Pin
BillWoodruff31-Oct-15 21:20
professionalBillWoodruff31-Oct-15 21:20 
GeneralRe: c # webbrowser Windows Media Player Pin
OriginalGriff31-Oct-15 21:39
mveOriginalGriff31-Oct-15 21:39 
GeneralRe: c # webbrowser Windows Media Player Pin
BillWoodruff31-Oct-15 22:03
professionalBillWoodruff31-Oct-15 22:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.