Code
1 public void addpeople(ArrayList arr)
2 {
3 SqlConnection con = new SqlConnection(constring);
4 con.Open();
5 SqlCommand cmd = new SqlCommand("addpeople", con);
6 cmd.CommandType = CommandType.StoredProcedure;
7 cmd.Parameters.Add("@name", SqlDbType.VarChar, 50).Value = arr[0];
8 cmd.Parameters.Add("@pass", SqlDbType.VarChar, 50).Value = arr[1];
9 cmd.Parameters.Add("@sex", SqlDbType.VarChar, 10).Value = arr[2];
10 cmd.Parameters.Add("@age", SqlDbType.Int).Value = arr[3];
11 cmd.Parameters.Add("@mail", SqlDbType.VarChar, 20).Value = arr[4];
12 cmd.Parameters.Add("@add", SqlDbType.VarChar,100).Value = arr[5];
13 cmd.Parameters.Add("@phone", SqlDbType.VarChar,12).Value = arr[6];
14 cmd.Parameters.Add("@proplem", SqlDbType.VarChar,50).Value = arr[7];
15 cmd.Parameters.Add("@key", SqlDbType.VarChar, 50).Value = arr[8];
16 cmd.Parameters.Add("@time", SqlDbType.DateTime).Value = arr[9];
17 try
18 {
19 cmd.ExecuteNonQuery();
20 }
21 catch (Exception err)
22 {
23 throw new System.Exception(err.Message);
24 }
25 finally
26 {
27 con.Close();
28 }
29 }
1 public void addpeople(ArrayList arr)
2 {
3 SqlConnection con = new SqlConnection(constring);
4 con.Open();
5 SqlCommand cmd = new SqlCommand("addpeople", con);
6 cmd.CommandType = CommandType.StoredProcedure;
7 cmd.Parameters.Add("@name", SqlDbType.VarChar, 50).Value = arr[0];
8 cmd.Parameters.Add("@pass", SqlDbType.VarChar, 50).Value = arr[1];
9 cmd.Parameters.Add("@sex", SqlDbType.VarChar, 10).Value = arr[2];
10 cmd.Parameters.Add("@age", SqlDbType.Int).Value = arr[3];
11 cmd.Parameters.Add("@mail", SqlDbType.VarChar, 20).Value = arr[4];
12 cmd.Parameters.Add("@add", SqlDbType.VarChar,100).Value = arr[5];
13 cmd.Parameters.Add("@phone", SqlDbType.VarChar,12).Value = arr[6];
14 cmd.Parameters.Add("@proplem", SqlDbType.VarChar,50).Value = arr[7];
15 cmd.Parameters.Add("@key", SqlDbType.VarChar, 50).Value = arr[8];
16 cmd.Parameters.Add("@time", SqlDbType.DateTime).Value = arr[9];
17 try
18 {
19 cmd.ExecuteNonQuery();
20 }
21 catch (Exception err)
22 {
23 throw new System.Exception(err.Message);
24 }
25 finally
26 {
27 con.Close();
28 }
29 }