I know how to create a web client that shows the resulting data set in a grid view but cant figure how to create a console client that will save the resulting xml.
copied below is the code for my web client.
Please guide to modify this for the console client that saves the xml.
webclient code:
namespace ResultsWebServicesClient
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
private void BindDataToGrid(string CaseNum)
{
FG_Results results = new FG_Results();
DataSet ds1 = new DataSet();
ds1 = results.Get_FG_Results(CaseNum);
GridView1.AutoGenerateColumns = true;
GridView1.DataSource = ds1.Tables[0];
GridView1.DataBind();
}
protected void GetResults(object sender, EventArgs e)
{
BindDataToGrid(CaseNo.Text);
}
}
}
web service code:
[WebService(Namespace = "http://localhost/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class FG_Results : System.Web.Services.WebService
{
public FG_Results()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod(Description = "Returns FG Results by CaseNum")]
public DataSet Get_FG_Results(string CaseNum)
{
String myConn = ConfigurationManager.ConnectionStrings["DBConnectionString"].ToString();
SqlConnection conn = new SqlConnection(myConn);
SqlCommand cmd = new SqlCommand();
SqlDataAdapter adapter = new SqlDataAdapter();
DataSet dsInfo = new DataSet();
string query = "SSRS.FlowComponentGroupDisplay";
try
{
cmd.CommandText = query;
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@CaseNo", CaseNum));
cmd.Connection = conn;
adapter.SelectCommand = cmd;
adapter.Fill(dsInfo, "FG_Results");
return dsInfo;
}
catch (Exception ex)
{
System.Web.HttpContext.Current.Response.Write(ex.Message);
return null;
}
finally
{
conn.Close();
}
}
}

New Topic/Question
Reply




MultiQuote






|