首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

webservice调用本机可以,但是传入FTP就不好使了

2011-12-26 
webservice调用本机可以,但是传到FTP就不好使了我做了一个二级连动下拉菜单,无刷新的,调用了webservice,客

webservice调用本机可以,但是传到FTP就不好使了
我做了一个二级连动下拉菜单,无刷新的,调用了webservice,
客户端部分代码:
<script   language= "javascript "   id= "clientEventHandlersJS ">
<!--

var   chassname;
var   baordname;


function   window_onload()  
{
service.useService( "/Service1.asmx?WSDL ", "myselect ");

chassname=service.myselect.callService(province_Result, "getProvince ");
}

function   province_Result(result)
{
if(!result.error)
  {  
    document.all( "dalanmu ").length=0;   
    if(result.value.substring(0,1)== ", ")
result.value   =result.value.substring(1,result.length);
    var   piArray   =   result.value.split( ', ');
    for(var   i=0;i <piArray.length;i++)
    {
      var   ary1   =   piArray[i].toString().split( '| ');
      document.all( "dalanmu ").options.add(new   Option(ary1[1].toString(),ary1[0].toString()));
    }    
  }
}

function   province_onchange()  
{
var   province=document.getElementById( "dalanmu ");
var   pindex   =   province.selectedIndex;
var   pValue   =   province.options[pindex].value;
var   pText     =   province.options[pindex].text;
baordname=service.myselect.callService(city_Result, "getCity ",pValue);
  document.getElementById( " <%=TextBox2.ClientID%> ").innerText=pValue;
}


function   city_Result(result)
{
if(!result.error)
  {
    document.all( "xiaolanmu ").length=0;
    if(result.value.substring(0,1)== ", ")
result.value   =result.value.substring(1,result.length);
    var   piArray   =   result.value.split( ", ");
    for(var   i=0;i <piArray.length;i++)
    {
      var   ary1   =   piArray[i].toString().split( "| ");
      document.all( "xiaolanmu ").options.add(new   Option(ary1[1].toString(),ary1[0].toString()));
    }
  }
}
        function   city_onchange()  
{
var   city=document.getElementById( "xiaolanmu ");
var   cindex   =   city.selectedIndex;
var   cValue   =   city.options[cindex].value;
var   cText     =   city.options[cindex].text;
                document.getElementById( " <%=TextBox3.ClientID%> ").innerText=cValue;
}


//-->
</script>
</HEAD>
<body   onload= "return   window_onload() ">
<div   id= "service "   style= "BEHAVIOR:url(webservice.htc) "> </div>
Service1.asmx.cs代码:
public   class   Service1   :   System.Web.Services.WebService
{
public   static   string   ConnectionString=System.Configuration.ConfigurationSettings.AppSettings[ "constr "];
SqlConnection   conn=new   SqlConnection(ConnectionString);

public   Service1()
{
//CODEGEN:   This   call   is   required   by   the   ASP.NET   Web   Services   Designer
InitializeComponent();


}

#region   Component   Designer   generated   code

//Required   by   the   Web   Services   Designer  
private   IContainer   components   =   null;

///   <summary>
///   Required   method   for   Designer   support   -   do   not   modify
///   the   contents   of   this   method   with   the   code   editor.
///   </summary>
private   void   InitializeComponent()
{
}

///   <summary>
///   Clean   up   any   resources   being   used.
///   </summary>
protected   override   void   Dispose(   bool   disposing   )
{
if(disposing   &&   components   !=   null)
{
components.Dispose();
}
base.Dispose(disposing);
}

#endregion

#region   getProvince
[WebMethod(true)]
public   string   getProvince()
{
string   sql= "select   *   from   SubTerritory   where   classboardid=1   order   by   classid ";
SqlCommand   cmd=new   SqlCommand(sql,conn);  

cmd.Connection.Open();
SqlDataReader   dr=cmd.ExecuteReader();

string   s= " ";
while(dr.Read())
{
s   +=   ", "   +   dr[ "ClassId "].ToString()   +   "| "   +   dr[ "ClassName "].ToString();
}
return   s;
}

#endregion

#region   getCity
[WebMethod(true)]
public   string   getCity(string   provinceid)
{
string   str= "select   *   from   SubTerritory   where   classboardid   =   0   and   classid= ' "+provinceid+ " '   order   by   boardid ";
SqlCommand   cmd=new   SqlCommand(str,conn);  

cmd.Connection.Open();
SqlDataReader   dr=cmd.ExecuteReader();

string   s= " ";
while(dr.Read())
{
s   +=   ", "   +   dr[ "BoardId "].ToString()   +   "| "   +   dr[ "BoardName "].ToString();
}
return   s;
}

大家帮忙啊,谢谢了,本机是   好   用   得,传上去就   不行了,我用得是VS2003+SQL2005


[解决办法]
怎么个不行法?
[解决办法]
webservice的域对不?是不是还是本地的

热点排行