i am making a website and i am going to integrate webservices into it,.i need to pass the below specified url ,load the xml data from the url and save into database.
DataSet ds;
SqlDataAdapter da;
SqlConnection con;
ds = new DataSet();
con = new SqlConnection(@"Data Source=;Initial Catalog=;Integrated Security=True");
ds.ReadXml("http://letitgo.asia/api/serviceTrans.go?apimode=test&goid=5011000001&password=test123&rtype=xml&service_family=01&msisdn=98989898&operator_code=28&amount=20&client_transid=1004");
SqlBulkCopy sbc = new SqlBulkCopy("Data Source=.;Initial Catalog=test;Integrated Security=True");
sbc.DestinationTableName = "vicky";
con.Open();
sbc.WriteToServer(ds.Tables[0]);
con.Close();
i am getting the xml data into my dataset....but the problem comes when i pass the dyanamic data
into above url.,i mean if i pass static values as parameters(&msisdn=9898989898',&amount=20')),i get the xml response..
.but if i try to pass the dynamic values in the parameter(&msisdn='"+TextBox1.Text +"',&amount='"+ TextBox2.Text +"').
I am not able to load xml from url...please help out ......as soon as posssible...thanks in advance....................
Rounak Rana
Member
48 Points
236 Posts
problem after loading xml from url
May 26, 2012 12:38 PM|LINK
i am making a website and i am going to integrate webservices into it,.i need to pass the below specified url ,load the xml data from the url and save into database.
DataSet ds; SqlDataAdapter da; SqlConnection con; ds = new DataSet(); con = new SqlConnection(@"Data Source=;Initial Catalog=;Integrated Security=True"); ds.ReadXml("http://letitgo.asia/api/serviceTrans.go?apimode=test&goid=5011000001&password=test123&rtype=xml&service_family=01&msisdn=98989898&operator_code=28&amount=20&client_transid=1004"); SqlBulkCopy sbc = new SqlBulkCopy("Data Source=.;Initial Catalog=test;Integrated Security=True"); sbc.DestinationTableName = "vicky"; con.Open(); sbc.WriteToServer(ds.Tables[0]); con.Close(); i am getting the xml data into my dataset....but the problem comes when i pass the dyanamic data into above url.,i mean if i pass static values as parameters(&msisdn=9898989898',&amount=20')),i get the xml response.. .but if i try to pass the dynamic values in the parameter(&msisdn='"+TextBox1.Text +"',&amount='"+ TextBox2.Text +"'). I am not able to load xml from url...please help out ......as soon as posssible...thanks in advance....................ds.ReadXml("http://letitgo.asia/api/serviceTrans.go?apimode=test&goid=5011000001&password=test123&rtype=xml&service_family=01&msisdn='"+TextBox1.Text +"'&operator_code=28&amount='"+ TextBox2.Text +"'&client_transid='"+ TextBox23.Text+"'");ds.ReadXml("http://letitgo.asia/api/serviceTrans.go?apimode=test&goid=5011000001&password=test123&rtype=xml&service_family=01&msisdn='"+TextBox1.Text +"'&operator_code=28&amount='"+ TextBox2.Text +"'&client_transid='"+ TextBox23.Text +"'");protected void Button1_Click(object sender, EventArgs e) { string op = ""; if(TextBox23.Text == "") { ClientScript.RegisterStartupScript(this.GetType(),"Message","alert('Enter Client trans id');",true); } mclientid = TextBox23.Text; if (TextBox1.Text == "") { ClientScript.RegisterStartupScript(this.GetType(), "Message", "alert('Enter mobile no');", true); } else mobile = TextBox1.Text; if (TextBox2.Text == "") { ClientScript.RegisterStartupScript(this.GetType(), "Message", "alert('Enter amount');", true); } else amount = TextBox2.Text; ds.ReadXml("http://letitgo.asia/api/serviceTrans.go?apimode=test&goid=5011000001&password=test123&rtype=xml&service_family=01&msisdn='"+TextBox1.Text +"'&operator_code=28&amount='"+ TextBox2.Text +"'&client_transid='"+ TextBox23.Text +"'");urgent
Mudasir.Khan
All-Star
15346 Points
3142 Posts
Re: problem after loading xml from url
May 26, 2012 06:17 PM|LINK
check whether those textboxes contains proper data
urgent
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: problem after loading xml from url
May 28, 2012 02:00 AM|LINK
Hello:)
Your msisdn hasn't a pair of single quote '',so I strongly recommand you:
1)Your TextBox's value must be right one。
2)Try to remove the pair of single quote and change to this:
ds.ReadXml("http://letitgo.asia/api/serviceTrans.go?apimode=test&goid=5011000001&password=test123&rtype=xml&service_family=01&msisdn="+TextBox1.Text +"&operator_code=28&amount="+ TextBox2.Text +"&client_transid="+ TextBox23.Text);