Hi,
I have been facing this problem for a long time and I hope someone could help me
1. I have a multiple selection list box whose values come from a sql table with a secondary data source Eg let us say there is a list of courses taken by a student like Mathematics, Science etc
2. Now I have a save button with which I want to save the selection made for each student
3. I have a output table (Student name and subject) and a procedure in sql to save the list of choices I made for each student
4. I was not sure how to save the choices selected for each student directly, so I convert them as a string in another text box in infopath and use this to save the choices made for a student to the table
5. I believe since I store it as a string from the text box instead of storing directly from the multiple select list box I am not able to retrieve the values back when I want to see again what were the subjects a student was enrolled earlier
Could some one help me to find how I can directly store multiple select list box value into a sql table and how I can retreive them again from the table to see what choices were made early.
Below is my current code
XPathNavigator dom = MainDataSource.CreateNavigator();
string StudentName = dom.SelectSingleNode("/my:myFields/my:CompanySnapshot/my:StudentName", NamespaceManager).Value;
string Subject = dom.SelectSingleNode("/my:myFields/my:TaxBusinessProcess/my:Subjecttextbox", NamespaceManager).Value; // this comes from the text box which converts selected choices into a string this needs to change
AdoQueryConnection connection = (AdoQueryConnection)DataConnections["Subject Choice"];
// Save the original statement that is stored in the Command property
string originalCommand = connection.Command;
// Execute the stored procedure
connection.Command = "EXEC SubjectProc'" + StudentName + "','" + Subject + "'";
connection.Execute();
// Restore the statement of the Command property to its original value
connection.Command = originalCommand;