Click here to Skip to main content
15,437,442 members
Home / Discussions / C#
   

C#

 
QuestionPass byte.TryParse() or int.tryParse() as argument Pin
Mc_Topaz11-Jul-14 1:03
MemberMc_Topaz11-Jul-14 1:03 
AnswerRe: Pass byte.TryParse() or int.tryParse() as argument Pin
Richard Deeming11-Jul-14 1:29
mveRichard Deeming11-Jul-14 1:29 
GeneralRe: Pass byte.TryParse() or int.tryParse() as argument Pin
Mc_Topaz11-Jul-14 1:45
MemberMc_Topaz11-Jul-14 1:45 
Questionwhat exactly below code do Pin
anil42010-Jul-14 21:24
Memberanil42010-Jul-14 21:24 
SuggestionRe: what exactly below code do Pin
Hemant Singh Rautela10-Jul-14 21:33
professionalHemant Singh Rautela10-Jul-14 21:33 
AnswerRe: what exactly below code do Pin
OriginalGriff10-Jul-14 21:39
mveOriginalGriff10-Jul-14 21:39 
SuggestionRe: what exactly below code do Pin
ZurdoDev11-Jul-14 1:47
professionalZurdoDev11-Jul-14 1:47 
QuestionC# insert command error Pin
PJeffrey10-Jul-14 16:11
MemberPJeffrey10-Jul-14 16:11 
I created the ff: code to insert a new record in database but the problem is it didn't add a new record in my database...

ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\memberInfo.mdf;Integrated Security=True;User Instance=True";
SqlConnection conn = new SqlConnection(ConnectionString);
String insertCommand = @"INSERT INTO members
            (m_id, fname, mname, lname, pres_add, p_add_con, h_add, h_add_con, office_add, off_add_con, proff_occ,
            spez, d_birth, p_birth, age, sex, c_status, d_marriage, citizenship, h_educ_att,
            h_educ_school, stud_school, stud_year, stud_course, spec_skills, bld_type, w_ser_att,
            mem_status, church_org_mem, comm_sugg)

            VALUES(
            @m_id, @fname, @mname, @lname, @pres_add, @p_add_con, @h_add, @h_add_con, @office_add, @off_add_con, @proff_occ,
            @spez, @d_birth, @p_birth, @age, @sex, @c_status, @d_marriage, @citizenship, @h_educ_att,
            @h_educ_school, @stud_school, @stud_year, @stud_course, @spec_skills, @bld_type, @w_ser_att,
            @mem_status, @church_org_mem, @comm_sugg
            )";
conn.Open();
SqlCommand cmd = new SqlCommand(insertCommand, conn);


        cmd.Parameters.AddWithValue("@m_id", txtMem_id.Text);
        cmd.Parameters.AddWithValue("@fname", txtFname.Text);
        cmd.Parameters.AddWithValue("@mname", txtMiddlename.Text);
        cmd.Parameters.AddWithValue("@lname", txtLastname.Text);
        cmd.Parameters.AddWithValue("@pres_add", txtPresAdd.Text);
        cmd.Parameters.AddWithValue("@p_add_con", txtPressAddCon.Text);
        cmd.Parameters.AddWithValue("@h_add", txtHomeAdd.Text);
        cmd.Parameters.AddWithValue("@h_add_con", txtHomeAddCon.Text);
        cmd.Parameters.AddWithValue("@office_add", txtOffAdd.Text);
        cmd.Parameters.AddWithValue("@off_add_con", txtOffAddCon.Text);
        cmd.Parameters.AddWithValue("@proff_occ", txtOffOcc.Text);
        cmd.Parameters.AddWithValue("@spez", txtSpez.Text);
        cmd.Parameters.AddWithValue("@d_birth", dtpBirthdate.Text);
        cmd.Parameters.AddWithValue("@p_birth", txtBirthPlace.Text);
        cmd.Parameters.AddWithValue("@age", txtAge.Text);
        cmd.Parameters.AddWithValue("@sex", cmb_sex.SelectedIndex);
        cmd.Parameters.AddWithValue("@c_status", cmb_CivilStatus.SelectedIndex);
        cmd.Parameters.AddWithValue("@d_marriage", txtDateMarr.Text);
        cmd.Parameters.AddWithValue("@citizenship", txtCitizenship.Text);
        cmd.Parameters.AddWithValue("@h_educ_att", txtHighEducAtt.Text);
        cmd.Parameters.AddWithValue("@h_educ_school", txtHighEducAttSchool.Text);
        cmd.Parameters.AddWithValue("@stud_school", txtStudSchool.Text);
        cmd.Parameters.AddWithValue("@stud_year", txtStudYear.Text);
        cmd.Parameters.AddWithValue("@stud_course", txtStudCourse.Text);
        cmd.Parameters.AddWithValue("@spec_skills", txtSpecSkill.Text);
        cmd.Parameters.AddWithValue("@bld_type", txtBldtype.Text);
        cmd.Parameters.AddWithValue("@w_ser_att", cmb_worSerAtt.SelectedIndex);
        cmd.Parameters.AddWithValue("@mem_status", cmb_MemStatus.SelectedIndex);
        cmd.Parameters.AddWithValue("@church_org_mem", cmb_memChurchOrg.SelectedIndex);
        cmd.Parameters.AddWithValue("@comm_sugg", txtCommSugg.Text);


        cmd.ExecuteNonQuery();
        conn.Close();
        MessageBox.Show("Data Saved");
        //rows number of record got inserted

AnswerRe: C# insert command error Pin
Dave Kreskowiak10-Jul-14 18:20
mveDave Kreskowiak10-Jul-14 18:20 
AnswerRe: C# insert command error Pin
jldavis515-Jul-14 8:13
Memberjldavis515-Jul-14 8:13 
QuestionPrivate chat Pin
Member 1076298010-Jul-14 11:15
MemberMember 1076298010-Jul-14 11:15 
AnswerRe: Private chat Pin
Dave Kreskowiak10-Jul-14 12:11
mveDave Kreskowiak10-Jul-14 12:11 
QuestionRe: Private chat Pin
ZurdoDev11-Jul-14 1:49
professionalZurdoDev11-Jul-14 1:49 
QuestionButton within a gridvew that clicking opens a form Pin
Member 1092277510-Jul-14 5:01
MemberMember 1092277510-Jul-14 5:01 
AnswerRe: Button within a gridvew that clicking opens a form Pin
Mycroft Holmes10-Jul-14 14:22
professionalMycroft Holmes10-Jul-14 14:22 
QuestionProblem Encode Base 64 Pin
KaKoten10-Jul-14 2:42
MemberKaKoten10-Jul-14 2:42 
AnswerRe: Problem Encode Base 64 Pin
OriginalGriff10-Jul-14 2:59
mveOriginalGriff10-Jul-14 2:59 
GeneralRe: Problem Encode Base 64 Pin
KaKoten10-Jul-14 18:03
MemberKaKoten10-Jul-14 18:03 
GeneralRe: Problem Encode Base 64 Pin
Dave Kreskowiak10-Jul-14 18:16
mveDave Kreskowiak10-Jul-14 18:16 
GeneralRe: Problem Encode Base 64 Pin
KaKoten10-Jul-14 19:00
MemberKaKoten10-Jul-14 19:00 
GeneralRe: Problem Encode Base 64 Pin
Bernhard Hiller10-Jul-14 21:07
MemberBernhard Hiller10-Jul-14 21:07 
GeneralRe: Problem Encode Base 64 Pin
Dave Kreskowiak11-Jul-14 1:31
mveDave Kreskowiak11-Jul-14 1:31 
GeneralRe: Problem Encode Base 64 Pin
KaKoten12-Jul-14 15:40
MemberKaKoten12-Jul-14 15:40 
QuestionCombobox.SelectedValue and Combobox.Text Pin
JCompiler10-Jul-14 1:45
MemberJCompiler10-Jul-14 1:45 
AnswerRe: Combobox.SelectedValue and Combobox.Text Pin
Mycroft Holmes10-Jul-14 14:25
professionalMycroft Holmes10-Jul-14 14:25 

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.