Service class
public string[] loadSecretQues(string email)
{
string[] ques= new string[3];
dbConn = new OdbcConnection(dbConnString);
dbConn.Open();
cmd = new OdbcCommand();
cmd.Connection = dbConn;
cmd = new OdbcCommand("SELECT q1, q2, q3 FROM Information WHERE EmailAdd = '" + email + "'", dbConn);
dRead = cmd.ExecuteReader();
while (dRead.Read())
{
if (dRead.HasRows)
{
for (int i = 1; i <= 3; i++)
{
for (int j = 0; j <= 3; j++)
{
ques[j] = dRead["q" + i].ToString();
}
return ques[i];
}
}
}
}
Page.aspx
protected void btnCheck_Click(object sender, EventArgs e)
{
cmbQues.Items.Add(srvc.loadSecretQues(txtEmail.Text));
}
Good day guys. I am seeking for help. I want to return array values from a function inside a class. The process is, I want to retrieve 3 questions (which are string data type) from my database and store it in a combobox. Any suggestions how to retrieve those three questions? Any other ways? Thanks in advance! :)