Hi,
I was hoping someone could help me. I've created an InfoPath form and saved it as source files to get the .xsd file. Then I use xsd.exe to generate the C# file representing the form. I've done this before without any trouble, but now I've included a repeating table and now the WebMethod fails.
I'm thinking either I don't go about populating the InfoPathFormService.group1 array or the InfoPathFormService.group2 objects which form part of that array, the right way. OR... perhaps the WebMethod doesn't like/permit having arrays as part of objects being returned.
This is the signature of my method:
[WebMethod]
public InfoPathFormService.myFields GetExpense(string guid)
{
//...
}
The structure of the class is the following (I've cut out everything except the myFields, group1, and group2 declarations):
namespace InfoPathFormService {
public partial class myFields {
private string nameField;
private string dateField;
private group2[] group1Field;
//...
}
public partial class group1 {
private group2[] group2Field;
}
public partial class group2 {
private string projectNameField;
//...
}
}
I have gone about populating the fields of the object like this:
InfoPathFormService.myFields singleExpense =
new InfoPathFormService.myFields();
// Fetch name and date
string sql = "SELECT name, date FROM expense_sheet" +
" WHERE guid='" + guid + "'";
DataSet ds = QueryDB(QueryType.Query, sql);
DataRow row = ds.Tables[0].Rows[0];
singleExpense.name = row["name"].ToString();
singleExpense.date = row["date"].ToString();
// Fetch expense entries
sql = "SELECT pname, pnumber, hotel, mileage, toll FROM expense_entry" +
" WHERE guid='" + guid + "'";
ds = QueryDB(QueryType.Query, sql);
InfoPathFormService.group2 expGroup =
new InfoPathFormService.group2();
expGroup.projectName = "A project name";
expGroup.projectNumber = "1003";
singleExpense.group1.SetValue(expGroup, 0);
Could someone please point me in the right direction?
Thank you.