【发布时间】:2014-04-14 05:03:59
【问题描述】:
public class RegistrationClass
{
SqlConnection myConnection = new SqlConnection("Data Source=MOE-PC\\SQLEXPRESS;Initial Catalog=db_University;Integrated Security=True;Pooling=False");
ConnectionClass con = new ConnectionClass();
int ID , i;
String fullName, motherName, gender, placeOfBirth, email, phone, adress, schoolDegree, languages, highSchool, faculty, major;
public void setValues (String fullName1,String motherName1,String gender1,String placeOfBirth1,String email1,String phone1,String adress1, String faculty1,String major1,String schoolDegree1,String languages1,String highSchool1)
{
fullName = fullName1;
motherName = motherName1;
gender = gender1;
placeOfBirth= placeOfBirth1;
email =email1;
phone= phone1;
adress =adress1;
faculty =faculty1;
major =major1;
schoolDegree =schoolDegree1;
languages =languages1;
highSchool = highSchool1;
}
这是点击注册按钮时的网络表单
public partial class WebForm1 : System.Web.UI.Page
{
protected void Button_Register_Click(object sender, EventArgs e)
{
string lang = "";
Classes.RegistrationClass R = new Classes.RegistrationClass();
R.setValues(txt_Name.ToString, txt_MotherName.ToString, dropDown_Gender.ToString, dropDown_POB.ToString, txt_Email.ToString, txt_Phone.ToString, txt_Adress.ToString, DropDown_Faculty.ToString, DropDown_Major.ToString, dropDown_SchoolDegree.ToString, txt_Name.ToString, txt_HighSchool.ToString);
这是错误:
'CCharpApp.RegistrationClass.setValues(string,string,string,string,string,string,string,string,string,string,string,string)' 的最佳重载方法匹配有一些无效参数。
【问题讨论】:
-
这就是为什么你不应该有这么多参数的函数。
-
这个方法需要一些TLC。