zoukankan      html  css  js  c++  java
  • 添加Web引用不是服务引用

    目的:地址写在代码中,不是配置文件里。引用这个类库的时候不需要配置文件。

     public JianPinForm()
            {

                InitializeComponent();
                
                OracleHelpers.Url = WebServiceConfig.Wsc.webConfigStr;//初始化的时候重新指定了路径

                jianpinTable = GetTable();
                if (jianpinTable != null && jianpinTable.Rows.Count > 0)
                {
                    this.dgvJP.DataSource = jianpinTable;
                }
            }

            //请不要调换这里的位置 就让他安静的呆着吧
            OracleHelperService.OracleHelper_zjyjy OracleHelpers = new OracleHelperService.OracleHelper_zjyjy();


            public DataTable GetTable()
            {
                DataTable contentDt = new DataTable("dt");
                //查询检品信息
                string strSql = "SELECT c_jianpinmc as \"检品名称\",c_jianpinbh as \"检品编号\",c_shoujianrq as \"收检日期\",c_baogaorq as \"报告日期\",c_pihao as \"批号\",c_guige as \"规格\",c_baozhuang as \"包装\",c_yangpinlb as \"类别\", " +
                                "c_jixing as \"剂型\",c_shengchangbcm as \"生产厂家\",c_gongyangdw as \"供样(报验)单位\",c_songyangdw as \"送样单位\",c_jianyanmd as \"检验目的\",c_jianyanxm as \"检验项目\",c_jianyanyj as \"检验标准\",c_zhujianks as \"主检科室\" " +
                                " from sample";

                contentDt = OracleHelpers.GetDataTableNoParam(strSql);

                return contentDt;
            }

    -----WebServiceConfig文件

     public string webConfigStr = string.Empty;
            public WebServiceConfig()
            {
                //本地测试访问
                webConfigStr = "http://192.168.0.11/yjs_WebServiceOracleHelper/OracleHelper_zjyjy.asmx";//
                //服务器地址测试访问
                //   webConfigStr = "http://localhost:33046/OracleHelper.asmx";
            }

            static WebServiceConfig wsc;
            public static WebServiceConfig Wsc
            {
                get
                {
                    if (wsc == null)
                    {
                        wsc = new WebServiceConfig();
                    }
                    return WebServiceConfig.wsc;
                }
            }

  • 相关阅读:
    树莓派成长日记03
    一些特殊文字的过滤Private Use Area:E000F8FF
    MongoDb 相关
    SQL 相关技术点收集贴
    正则表达式提取文本的日期
    MVC 相关技术点收集贴
    使用 json2.js注意点
    C#画图 GDI+
    PHP模拟POST,验证页面的返回状态
    EF-Entity Framework 相关技术点收集贴
  • 原文地址:https://www.cnblogs.com/wenbing/p/3509777.html
Copyright © 2011-2022 走看看