Question : DropDownList value does not get inserted into sql table

I am struggling to find out why the displayed value of 2 of my drop down lists does not get inserted into the table...

I have tried changing the data types of my columns in sql server 20005 management studio , I check my stored procedure, and everything looks fine... One thing is if I happen to give values to my drop down list in the default aspx page, those are inserted. So I know is got to be something I am missing,, much help is appreciated , thanks for your help
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
In Default aspx. I have

<table style="width: 100%">
        <tr>
            <td>
                <b>Nurses/Tech Name: </b> <span>
            &nbsp;<asp:dropDownList ID="Nurses" runat="server" CssClass="dropDownList" DataValueField="NursesTable">
                    
                </asp:dropDownList>
        &nbsp;&nbsp;
        </span>
       
            </td>
            <td>
            <b>Department:<asp:DropDownList ID="departmentTextBox" runat="server">
                <asp:ListItem>DHR Surgery</asp:ListItem><asp:ListItem>WHR Surgery</asp:ListItem><asp:ListItem>CVOR</asp:ListItem><asp:ListItem>Cath Lab</asp:ListItem><asp:ListItem>Radiology</asp:ListItem><asp:ListItem>Endoscopy</asp:ListItem></asp:DropDownList></b>           
             </td>
        </tr>
        <tr>
            <td>
            <b>Physician&#39;s Name:</b>
        
    <asp:dropdownlist ID="Physician" runat="server" DataValueField="DoctorTable">
                     </asp:dropdownlist>
        &nbsp;</td>
            <td>
            <b>Visit ID:<asp:TextBox ID="VisitID" runat="server" ></asp:TextBox>
            </b>
            </td>
        </tr>
        <tr>
            <td>
            <b>Procedure:</b>
        <span class="dropDownList">
            <asp:textbox ID="procedureTextBox" runat="server" Width="300px"></asp:textbox>
       
        </span>
            </td>
            <td>
            <b>Date:</b>
            <asp:Label ID="dateLabel" runat="server" CssClass="dateFont"></asp:Label>      
            </td>
        </tr>
    </table>


In Default.aspx.cs I have

   protected void Submit_Click(object sender, EventArgs e)
    {
        
       
        SqlConnection conn = new
// Omitted for security in EE 
        SqlCommand cmd = new SqlCommand("AddData", conn);
        cmd.CommandType = CommandType.StoredProcedure;
                
        cmd.Parameters.AddWithValue("@userID", authUserName);
        cmd.Parameters.AddWithValue("@nurseName", Nurses.Text.ToString());
        cmd.Parameters.AddWithValue("@physicianName",Physician.Text.ToString());
        cmd.Parameters.AddWithValue("@visitID", VisitID.Text);
        cmd.Parameters.AddWithValue("@department", departmentTextBox.Text);
        cmd.Parameters.AddWithValue("@procedure", procedureTextBox.Text);
        cmd.Parameters.AddWithValue("@date", dateLabel.Text);
        cmd.Parameters.AddWithValue("@question1", RadioButtonList1.SelectedValue);
        cmd.Parameters.AddWithValue("@question2", RadioButtonList2.SelectedValue);
        cmd.Parameters.AddWithValue("@question3", RadioButtonList3.SelectedValue);
        cmd.Parameters.AddWithValue("@question4", RadioButtonList4.SelectedValue);
        cmd.Parameters.AddWithValue("@question5", RadioButtonList5.SelectedValue);
        cmd.Parameters.AddWithValue("@question6", RadioButtonList6.SelectedValue);
        cmd.Parameters.AddWithValue("@question7", RadioButtonList7.SelectedValue);
        cmd.Parameters.AddWithValue("@question8", RadioButtonList8.SelectedValue);
        cmd.Parameters.AddWithValue("@question9", RadioButtonList9.SelectedValue);

        //OPENING Connection
        conn.Open();
        cmd.ExecuteNonQuery();

        //END Database Connection
        conn.Close();
                   
        // Sends user to redirect page
        Response.Redirect(Submit.CommandArgument.ToString());
        Reset();
    }

Answer : DropDownList value does not get inserted into sql table

Depending upon how many machines you have, you can see the MAC address of the duplicate name it tells you in  event viewer, I had this on my network to find that two colleagues were running the same virtual server with the same name and I tracked it by MAC address, I only have 11 PCs so it was not a big task.

One way would be to switch everything off and start one by one until you get the error. It is possible to have a DNS entry for one machine and another with the local name. I did this to get round mapped drive issues etc, called the new server a new name and gave it a DNS alias of the old server once swithced off, if I had put the old server back on again I would have had duplicate names. CHeck DNS also
Random Solutions  
 
programming4us programming4us