Decided to use sql in mvc to write the select with the variables for tablename not known until runtime. This is not returning to json what is wrong with this.
using (SqlConnection connection = new SqlConnection("test") {
SqlCommand command = new SqlCommand();
command.CommandText = @"Select Organization from " + tablename + " df join Signature sg on sg.FormInstanceId = df.FormInstanceId where sg.FullName = '" + who + "'";
command.CommandType = CommandType.Text;
connection.Open();
SqlDataReader reader = command.ExecuteReader();
// Call Read before accessing data.
while (reader.Read())
{
for (int i = 0; i < reader.FieldCount; i++)
{
var subject = reader.GetString(3);
result.Add(subject);
}
}
}
return Json(result, JsonRequestBehavior.AllowGet);