学习资料搜集--从后台取数据填充下拉框

数据层
 

 1 None.gif public  DataSet GetAllQuoter()
 2 ExpandedBlockStart.gifContractedBlock.gif         dot.gif {
 3InBlock.gif            StringBuilder commandText = new StringBuilder("SELECT distinct  ReportMain.FromName FROM ReportMain ");
 4InBlock.gif            DataSet ds = new DataSet();
 5InBlock.gif                SqlConnection Conn = null;
 6InBlock.gif            try
 7ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 8InBlock.gif                if (Connection==null)
 9ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
10InBlock.gif                    Conn = new SqlConnection(strConn);
11InBlock.gif                    Conn.Open();
12ExpandedSubBlockEnd.gif                }

13InBlock.gif                else
14InBlock.gif                    Conn = (SqlConnection)Connection;
15InBlock.gif                SqlCommand DSCmd = new SqlCommand(commandText.ToString(),Conn);
16InBlock.gif                if (Transaction!=null)
17InBlock.gif                    DSCmd.Transaction = (SqlTransaction)Transaction;
18InBlock.gif
19InBlock.gif                                SqlDataAdapter DBAdopter = new System.Data.SqlClient.SqlDataAdapter(DSCmd);
20InBlock.gif                DBAdopter.Fill(ds);
21ExpandedSubBlockEnd.gif            }

22InBlock.gif            catch (Exception e)
23ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
24InBlock.gif                throw new Exception(e.Message);
25ExpandedSubBlockEnd.gif            }

26InBlock.gif            finally
27ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
28InBlock.gif                if (Conn!=null&&Connection==null) Conn.Close();
29ExpandedSubBlockEnd.gif            }

30InBlock.gif            return ds;
31ExpandedBlockEnd.gif        }

32 None.gif
33 None.gif

BPO

 1 ExpandedBlockStart.gif ContractedBlock.gif /**/ /// <summary>
 2InBlock.gif        /// 取得所有的报价人
 3InBlock.gif        /// </summary>
 4ExpandedBlockEnd.gif        /// <returns></returns>

 5 None.gif         [WebMethod(EnableSession  =   true )]
 6 None.gif         public   string  GetAllQuoters()
 7 ExpandedBlockStart.gifContractedBlock.gif         dot.gif {
 8InBlock.gif               DBLayer.ReportMain report = new ReportMain();
 9InBlock.gif               DataSet ds = report.GetAllQuoter();
10InBlock.gif               DataTable dt = ds.Tables[0];
11InBlock.gif               string str = "|";
12InBlock.gif              foreach(DataRow dr in dt.Rows)
13ExpandedSubBlockStart.gifContractedSubBlock.gif               dot.gif{
14InBlock.gif                     str = str + dr[0].ToString()+"|";
15ExpandedSubBlockEnd.gif               }

16InBlock.gif               str = str.Substring(0,str.Length-1);
17InBlock.gif               return str;
18ExpandedBlockEnd.gif        }

19 None.gif


 前端HTC

 1 None.gif function  CallGetAllQuoters()
 2 ExpandedBlockStart.gifContractedBlock.gif dot.gif {
 3InBlock.gif    this.ServiceHandle=eval(ServiceID);
 4InBlock.gif    if(ServiceHandle!=null)
 5ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
 6InBlock.gif        ServiceHandle.useService(theBPOName+".asmx?WSDL",theBPOName+"Service");
 7InBlock.gif        var srv=eval("ServiceHandle."+theBPOName+"Service");
 8InBlock.gif        ObjectGetAllQuotersTask.CallID=srv.callService("GetAllQuoters");
 9ExpandedSubBlockEnd.gif    }

10ExpandedBlockEnd.gif}

11 None.gif
12 None.gif function  DoResultGetAllQuoters()
13 ExpandedBlockStart.gifContractedBlock.gif dot.gif {
14InBlock.gif    this.DoResult = function(result)
15ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
16InBlock.gif        if(result.error==false)
17ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
18InBlock.gif            var piArray = result.value.split("|");
19InBlock.gif              for(var i=0;i<piArray.length;i++)
20ExpandedSubBlockStart.gifContractedSubBlock.gif              dot.gif{
21InBlock.gif                  e = document.createElement("OPTION")
22InBlock.gif                      e.text = piArray[i];
23InBlock.gif                      e.value = piArray[i];
24InBlock.gif                      Form1.FromNameEdit0.add(e);
25ExpandedSubBlockEnd.gif              }

26InBlock.gif
27ExpandedSubBlockEnd.gif        }

28ExpandedSubBlockEnd.gif    }

29ExpandedBlockEnd.gif}

转载于:https://www.cnblogs.com/xuxianpeng/archive/2006/09/15/504863.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值