Beispiel #1
0
        private void TestSQLCommand()
        {
            //   Debug.Listeners.Add(listener);
            SqlDataAccess sql = new SqlDataAccess();

            SqlParameter[] para = new SqlParameter[1];

            para[0] = new SqlParameter("@cement_id", 100);
            var value = sql.ExecuteDeleteQuery("DELETE FROM cement where cement_id=@cement_id", para);

            Debug.WriteLine("Query result: " + value);

            /*
             * param = new SqlParameter("@cement_id", 2);
             * SqlParameter[] para = new SqlParameter[1];
             * para[0] = param;
             *
             * DataTable results = sql.ExecuteSelectQuery("select * from cement where cement_id = @cement_id", para);
             * for (int i = 0; i < results.Count; i++)
             * {
             *  Debug.WriteLine(results.GetElementAt(i).Value("cement_id").ToString());
             *  Debug.WriteLine(results.GetElementAt(i).Value("name").ToString());
             *  Debug.WriteLine(results.GetElementAt(i).Value("symbol").ToString());
             * }
             * Debug.Flush();
             * List<SqlParameter> para2 = new List<SqlParameter>();
             * para2.Add(new SqlParameter("cement_id", 102));
             * para2.Add(new SqlParameter("symbol", "LINH"));
             * para2.Add(new SqlParameter("name", "No"));
             * sql.ExecuteInsertOrUpdateQuery("insert into cement values(@cement_id,@symbol,@name)", para2.ToArray());
             */
            return;
        }