webservice+xml+javascript实现局部刷新

leavesbywind 2004-07-01 08:43:07
各位大哥,我想通过javascript时时的将webservice的数据绑定到.aspx上去,<注:不用html的refresh>希望能够有比较完整的事例代码。谢谢!!
...全文
301 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
terryxin 2004-07-02
  • 打赏
  • 举报
回复
可以实现,我们以前就是用的这个方案,但现在放下了,因为webservice的安全性实在不是很好,没办法
elite2018 2004-07-02
  • 打赏
  • 举报
回复
http://support.microsoft.com/default.aspx?scid=kb;en-us;555057

Creating the Web Service

The next step is to create the web service that you intend to consume. If you are using SQL Server 2000, most of the work is already done for you. If not, then you may need to work with the data that your database returned in order to form it into XML that you can pass back to the client. First, you should create a new web service in your project. Then, the following C# code will return the XML that you need on the client in order to render this SELECT object:

[WebMethod]

public XmlDocument GetSelectObject(string param) {

XmlDocument xmlReturnDocument = new XmlDocument();

using (SqlConnection connMyConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"])) {

using (SqlCommand cmdWebServiceProc= new SqlCommand("MyDatabase.dbo.WebServiceProc", connMyConnection)) {

cmdWebServiceProc.CommandType = CommandType.StoredProcedure;

cmdWebServiceProc.Parameters.Add("@pram", SqlDbType.VarChar, 4).Value = param;

try {

connMyConnection.Open();

12,165

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧