当前位置: 首页>>代码示例>>C#>>正文


C# DataConnection.CloseConnection方法代码示例

本文整理汇总了C#中DataConnection.CloseConnection方法的典型用法代码示例。如果您正苦于以下问题:C# DataConnection.CloseConnection方法的具体用法?C# DataConnection.CloseConnection怎么用?C# DataConnection.CloseConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataConnection的用法示例。


在下文中一共展示了DataConnection.CloseConnection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load


//.........这里部分代码省略.........
                                    sql = "select ";
                                    sql2 = "";
                                    theComma = "";

                                    for (int i = 0; i < resultA.FieldCount; i++)
                                    {
                                        if ((String)requestData["key"] == resultA.GetName(i) || (String)requestData["value"] == resultA.GetName(i))
                                        {
                                            if (resultA.GetFieldType(i) == typeof(DateTime))
                                            {

                                                sql2 += theComma + "TO_CHAR(" + resultA.GetName(i) + ", 'MM/DD/YYYY') " + resultA.GetName(i);
                                            }
                                            else if (resultA.GetFieldType(i) != typeof(String))
                                            {

                                                sql2 += theComma + "TO_CHAR(" + resultA.GetName(i) + ") " + resultA.GetName(i);
                                            }
                                            else
                                            {
                                                sql2 += theComma + resultA.GetName(i);
                                            }

                                            if ((String)requestData["key"] == resultA.GetName(i))
                                            {
                                                sql2 += " KEY ";
                                            }
                                            else if ((String)requestData["value"] == resultA.GetName(i))
                                            {
                                                sql2 += " VALUE ";
                                            }
                                            if (!sql2.Equals(""))
                                            {
                                                theComma = ", ";
                                            }
                                        }
                                    }
                                    resultA.Close();

                                    finalSQL = sql + sql2 + " from " + request;
                                    if ((String)requestData["filter"] != "")
                                    {
                                        finalSQL += " where " + ((String)requestData["filter"]).Replace("'", "''") + "'";
                                    }
                                    //finalSQL = "select * from (" + finalSQL + ") where ROWNUM <= 100";
                                    result = theDB.execQuery(finalSQL);

                                    if (result != null)
                                    {
                                        while (result.Read())
                                        {
                                            response = new Dictionary<String, String>();
                                            for (int i = 0; i < result.FieldCount; i++)
                                            {
                                                String theValue = "";
                                                try
                                                {
                                                    theValue = result.GetString(i);
                                                }
                                                catch (Exception ex) { }

                                                response.Add(result.GetName(i), theValue);
                                            }
                                            responses.Add(response);
                                        }
                                        result.Close();
                                        responses.Sort(delegate(Dictionary<String, String> d1, Dictionary<String, String> d2) { return d1["VALUE"].CompareTo(d2["VALUE"]); });
                                    }
                                    result.Close();

                                    status.Add("result", "true");
                                    status.Add("message", "");
                                    responsePackage.Add("data", responses);
                                    responsePackage.Add("status", status);

                                    Response.Write(rs.Serialize(responsePackage));

                                    //Response.Write(rs.Serialize(responses));
                                    break;
                            }
                            theDB.CloseConnection();
                        }

                        break;
                }

            }
            catch (Exception ex)
            {

                status.Add("result", "false");
                status.Add("message", ex.Message + "\n" + ex.StackTrace);
                responsePackage.Add("data", "");
                responsePackage.Add("status", status);

                Response.Write(rs.Serialize(responsePackage));

                //Response.Write(ex.Message + "\n" + ex.StackTrace);
            }
        }
开发者ID:RandomMinds,项目名称:WebAppToolkit,代码行数:101,代码来源:default.aspx.cs


注:本文中的DataConnection.CloseConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。