Everything was working fine before. The only thing I did was added an Edit Button, then this error occurred. Even though I undo the Edit Button, the error still persist. Can anyone tell me what is wrong with line 26?
SqlCommand cmdDoctorInfo = new SqlCommand("SELECT d.* FROM Doctorinfo p, Department d WHERE d.DepartmentID = p.DepartmentID AND p.userId = @UserID", conDoctorInfo);
Line 26: cmdDoctorInfo.Parameters.AddWithValue("@UserID", Session["UserId"].ToString());
SqlDataReader dtrPatient = cmdDoctorInfo.ExecuteReader();
Edit: For some unknown reason, it suddenly works fine after I closed and opened the app over and over again. Now when I add back the Edit Button, the error comes back. Here is the Edit Button code (2nd line)
<td align="center">
<asp:Button ID="editButton" runat="server" OnClick="editButton_Click" Text="Edit" />
<asp:FileUpload ID="picFileUpload" runat="server"/>
<asp:Button ID="uploadButton" runat="server" OnClick="uploadButton_Click" Text="Upload"/>
<br />
<asp:Label ID="messageLabel" runat="server" ForeColor="Red"></asp:Label>
</td>
I don't understand how does adding an Edit button cause the error. Please enlighten me.