kokas79

kokas79

  • NA
  • 1
  • 0

Parameter problem with arrays

May 21 2004 4:36 AM
I'm using arrays in a web application i'm building and it's been a whole day that i can't work this out. Specifically, i am trying to call a method that i created " public static int ExecuteNonQuery (string proc, SqlParameter [] param) " So in the page that i'm calling it, i'm also declaring the array of SqlParameter like this: SqlParameter[] param = new SqlParameter[4]; --> param[0] = {"@sname", SqlDbType.NVarChar, 30}; param[0].Value = this.TextBox3.Text; --> param[1] = {"@saddr", SqlDbType.NVarChar, 60}; param[1].Value = this.TextBox4.Text; --> param[2] = {"@sparentphone", SqlDbType.NVarChar, 24}; param[2].Value = this.TextBox5.Text; --> param[3] = {"@sparentemail", SqlDbType.NVarChar, 40}; param[3].Value = this.TextBox6.Text; --> param[4] = {"@sdob", SqlDbType.NVarChar, 10}; param[4].Value = this.TextBox7.Text; But when i run it i get errors on the lines above pointed by the errors. Errors like " ; expected" and others syntactical ones. What is wrong with my syntax? Have you got any suggestions?

Answers (1)