コード例 #1
0
ファイル: ajax.aspx.cs プロジェクト: SAEONData/SAEON-Species
        void loadtransects()
        {
            int              cruise = int.Parse(Request["cruise"]);
            String           query  = "SELECT * FROM Transect WHERE CruiseID = " + cruise + "ORDER BY TransectRef";
            List <comboItem> items  = new List <comboItem>();

            using (SqlConnection connection = new SqlConnection(DataSources.dbConSpecies))
            {
                connection.Open();
                using (SqlCommand command = new SqlCommand(query, connection))
                {
                    using (SqlDataReader set = command.ExecuteReader())
                    {
                        while (set.Read())
                        {
                            comboItem item = new comboItem();
                            item.id   = (int)set["fEventID"];
                            item.name = (string)set["TransectRef"];
                            items.Add(item);
                        }
                    }
                }
            }
            JavaScriptSerializer js = new JavaScriptSerializer();

            Response.Write(js.Serialize(items));
        }
コード例 #2
0
ファイル: ajax.aspx.cs プロジェクト: SAEONData/SAEON-Species
        void loadcruises()
        {
            int              vessel = int.Parse(Request["vessel"]);
            String           query  = "SELECT * FROM TblSurvey ORDER BY fSurveyLabel";
            List <comboItem> items  = new List <comboItem>();

            using (SqlConnection connection = new SqlConnection(DataSources.dbConSpecies))
            {
                connection.Open();
                using (SqlCommand command = new SqlCommand(query, connection))
                {
                    using (SqlDataReader set = command.ExecuteReader())
                    {
                        while (set.Read())
                        {
                            comboItem item = new comboItem();
                            item.id   = (int)set["fSurveyID"];
                            item.name = (string)set["fSurveyLabel"];
                            items.Add(item);
                        }
                    }
                }
            }
            JavaScriptSerializer js = new JavaScriptSerializer();

            Response.Write(js.Serialize(items));
        }