예제 #1
0
        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
        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));
        }