title: Use SqlDataReader and string array
body: <p>I want to use data reader to read a record and send the result to an array string.</p>
  
  <p>I use a stored procedure to select data from 2 tables.</p>
  
  <pre><code>string ReqID = "";
  string ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
  SqlConnection sqlc;
  string[] textbox;
  string ReqType;
  
  protected void Page_Load(object sender, EventArgs e)
  {
      if (Request.QueryString["ReqID"] != null)
          ReqID = this.Request.QueryString["ReqID"];
  
      sqlc = new SqlConnection(ConnectionString);
      SqlCommand cmd = new SqlCommand();
      cmd.CommandType = CommandType.StoredProcedure;
      cmd.CommandText = "LoadReq";
  
      string[] textbox = new string[4];
      if (!this.IsPostBack)
      {
          if (ReqID != "")
          {
              cmd.Parameters.Add("@ReqID", SqlDbType.NChar).Value = ReqID;
              cmd.Connection = sqlc;
              sqlc.Open();
  
              SqlDataReader reader = cmd.ExecuteReader();
  
              while (reader.Read())
              {
                  textbox[2] = reader.GetString(reader.GetOrdinal("FReqID"));
                  textbox[3] = reader.GetString(reader.GetOrdinal("OrderDate"));
                  textbox[4] = reader.GetString(reader.GetOrdinal("OrderTime"));
                  textbox[5] = reader.GetString(reader.GetOrdinal("ReqIP"));
                  textbox[6] = reader.GetString(reader.GetOrdinal("Status"));
                  textbox[7] = reader.GetString(reader.GetOrdinal("FileCode"));
                  textbox[8] = reader.GetString(reader.GetOrdinal("Type"));
                  textbox[9] = reader.GetString(reader.GetOrdinal("DOI"));
                  textbox[10] = reader.GetString(reader.GetOrdinal("PubMedID"));
                  textbox[11] = reader.GetString(reader.GetOrdinal("PaperCode"));
  
  
                  LoadCorrectForm(textbox[8], textbox);
              }
          }
  </code></pre>
  
  <p>And my stored procedure is:</p>
  
  <pre><code>CREATE PROCEDURE [dbo].LoadReq
  @ReqID int = 0
  AS
  SELECT 
          Request.FReqID, Request.ReqIP, Request.OrderDate, Request.OrderTime,
          Request.[Status], Request.FileCode, Request.[Description],
          Details.[Type], Details.DOI, Details.PubMedID, Details.PaperCode, 
          Details.ISBN, Details.Title, Details.Journal, Details.BookTitle,
          Details.Conference, Details.[Year], Details.Publisher, Details.Edition, 
          Details.Vol, Details.Issue, Details.pp, Details.[Author(s)],
          Details.URL
       FROM 
          Request 
       INNER JOIN 
          Details ON Details.ID = Request.FreqID
       WHERE 
          (Request.ID = @ReqID)
  </code></pre>
  
  <p>But I get an error.</p>
  
  <p>How should I edit my code to do this job?</p>