public static object SqlQuery(string query)
        {
            try
            {
                var Connection = Metoder.ÖppnaAnslutning();
                var command    = new SqlCommand();

                var dataAdapter = new SqlDataAdapter(query, Connection);
                var dataSet     = new DataSet();


                Connection.Open();
                dataAdapter.Fill(dataSet, "datavarde");

                return(dataSet);
            }
            catch { return(null); }
        }
Exemple #2
0
        public void SqlQuery(string query)
        {
            try
            {
                var Connection = Metoder.ÖppnaAnslutning();
                var command    = new SqlCommand();

                var dataAdapter = new SqlDataAdapter(query, Connection);
                var dataSet     = new DataSet();


                Connection.Open();
                dataAdapter.Fill(dataSet, "datavarde");


                dataGridView1.DataSource = dataSet;
                dataGridView1.DataMember = "datavarde";
            }  catch { MessageBox.Show("insert query!"); }
        }