load xml into c# dataset
Posted on 2007-10-16
hey guys -
i have an xml schema in a dataset called "FormData".
then i have this function where i am trying to load in an xml file generated by a stored procedure.
the problem is that it seems that my dataset isn't getting populated. whenever i do the writeline debugging - it does actually print the data being returned by the stored proc (sql 2k5), but it doesn't fill the dataset it seems when i call it in my main function and try to databind the contents of it to a combo box. i do know that the schema returned by my stored proc does match the xml returned by my stored proc
do you guys see anything i'm doing wrong?
public static void LoadDataSet(string connection, string sp, ref FormData dataset)
if (dataset == null)
SqlConnection connDB = new SqlConnection(connection);
SqlCommand cmdDB = connDB.CreateCommand();
cmdDB.CommandText = String.Concat("exec ", sp);
XmlReader sDB = cmdDB.ExecuteXmlReader();
while (sDB.ReadState != ReadState.EndOfFile)
FormData myDS = new FormData();
"spanme", ref myDS);
ddlState.DataSource = myDS;
ddlState.DisplayMember = "State";
thanks guys :)