Exemplo n.º 1
0
        //  用生成的代码插入数据
        public static void AddRecords(AutoLotDataSet.InventoryDataTable tb,
                                      InventoryTableAdapter dAdapt)
        {
            try
            {
                //  从表中获取新的强类型的行
                AutoLotDataSet.InventoryRow newRow = tb.NewInventoryRow();

                //  使用一些示例数据填充该行
                newRow.CarID   = 999;
                newRow.Color   = "Purple";
                newRow.Make    = "BMW";
                newRow.PetName = "Saku";

                //  插入新行
                tb.AddInventoryRow(newRow);

                //  使用重载的Add方法添加另一个行
                tb.AddInventoryRow(888, "Yugo", "Green", "Zippy");

                //  更新数据库
                dAdapt.Update(tb);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        public static void AddRecords(
            AutoLotDataSet.InventoryDataTable table,
            InventoryTableAdapter adapter)
        {
            try
            {
                // Get a new strongly typed row from the table.
                AutoLotDataSet.InventoryRow newRow = table.NewInventoryRow();

                // Fill row with some sample data.
                newRow.Color = "Purple";
                newRow.Make  = "BMW";
                newRow.Name  = "Saku";

                // Insert the new row.
                table.AddInventoryRow(newRow);

                // Add one more row, using overloaded Add method.
                table.AddInventoryRow("Yugo", "Green", "Zippy");

                // Update database.
                adapter.Update(table);
            }
            catch (Exception ex)
            {
                WriteLine(ex.Message);
            }
        }
Exemplo n.º 3
0
        private static void AddRecords(AutoLotDataSet.InventoryDataTable dt, InventoryTableAdapter dAdapt)
        {
            try
            {
                // Получить из таблицы новую строго типизированную строку
                AutoLotDataSet.InventoryRow newRow = dt.NewInventoryRow();

                // Заполнить строку данными
                newRow.CarID   = 999;
                newRow.Color   = "Purple";
                newRow.Make    = "BMW";
                newRow.PetName = "Saku";

                // Вставить новую строку
                dt.AddInventoryRow(newRow);

                // Добавить еще одну строку, используя перегруженный метод добавления
                dt.AddInventoryRow(777, "Yugo", "Green", "Zippy");

                // Обновить базу данных
                dAdapt.Update(dt);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemplo n.º 4
0
 private static void AddRecords(AutoLotDataSet.InventoryDataTable table, InventoryTableAdapter adapter) // Добавление записей
 {
     AutoLotDataSet.InventoryRow newRow = table.NewInventoryRow();                                      // Получение из таблицы новой строго типизированной строки
     newRow.CarID   = 999;                                                                              // Заполнение строки данными
     newRow.Color   = "Purple";
     newRow.Make    = "BMW";
     newRow.PetName = "Saku";
     table.AddInventoryRow(newRow); // Вставка новой строки
     table.AddInventoryRow(888, "Yugo", "Green", "Zippy");
     adapter.Update(table);         // Обновление базы данных
 }
Exemplo n.º 5
0
        private static void AddRecords(AutoLotDataSet.InventoryDataTable table, InventoryTableAdapter adapter)
        {
            AutoLotDataSet.InventoryRow newRow = table.NewInventoryRow();
            newRow.Color   = "Purple";
            newRow.Make    = "BMW";
            newRow.PetName = "Saku";
            table.AddInventoryRow(newRow);

            table.AddInventoryRow("Yugo", "Green", "Zippy");

            adapter.Update(table);
        }
Exemplo n.º 6
0
        public static void AddRecords(AutoLotDataSet.InventoryDataTable table, InventoryTableAdapter adapter)
        {
            try
            {
                //add new row
                AutoLotDataSet.InventoryRow newRow = table.NewInventoryRow();
                Console.WriteLine("Enter new color:");
                newRow.Color = (string)Console.ReadLine();
                Console.WriteLine("Enter new Make:");
                newRow.Make = (string)Console.ReadLine();
                Console.WriteLine("Enter new PetName:");
                newRow.PetName = (string)Console.ReadLine();
                table.AddInventoryRow(newRow);

                ////another way (Dont forget about position in constructor)
                //Console.WriteLine("Enter new color:");
                //string strColor = (string)Console.ReadLine();
                //Console.WriteLine("Enter new Make:");
                //string strMake = (string)Console.ReadLine();
                //Console.WriteLine("Enter new PetName:");
                //string strPetName = (string)Console.ReadLine();
                //table.AddInventoryRow(strMake, strColor, strPetName);

                adapter.Update(table);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemplo n.º 7
0
 public static void AddRecords(AutoLotDataSet.InventoryDataTable table, InventoryTableAdapter adapter)
 {
     try
     {
         var newRow = table.NewInventoryRow();
         newRow.Color   = "Purple";
         newRow.Make    = "BMW";
         newRow.PetName = "Saku";
         table.AddInventoryRow(newRow);
         table.AddInventoryRow("Yugo", "Green", "Zippy");
         adapter.Update(table);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Exemplo n.º 8
0
 public static void AddRecords(AutoLotDataSet.InventoryDataTable tb, InventoryTableAdapter dAdapt)
 {
     try
     {
         AutoLotDataSet.InventoryRow newRow = tb.NewInventoryRow();
         //
         newRow.CarID   = 991;
         newRow.Color   = "Purple";
         newRow.Make    = "BMW";
         newRow.PetName = "Saku";
         //
         tb.AddInventoryRow(newRow);
         tb.AddInventoryRow(887, "Yugo", "Green", "Zippy");
         dAdapt.Update(tb);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Exemplo n.º 9
0
        public static void AddRecords(AutoLotDataSet.InventoryDataTable tb, InventoryTableAdapter dAdapt)
        {
            // Get a new strongly typed row from the table.
            AutoLotDataSet.InventoryRow newRow = tb.NewInventoryRow();

            // Fill row with some sample data.
            newRow.CarID   = 999;
            newRow.Color   = "Purple";
            newRow.Make    = "BMW";
            newRow.PetName = "Saku";

            // Insert the new row.
            tb.AddInventoryRow(newRow);

            // Add one more row, using overloaded Add method.
            tb.AddInventoryRow(888, "Yugo", "Green", "Zippy");

            // Update database.
            dAdapt.Update(tb);
        }