示例#1
0
        private void odbcDataAdapter1_RowUpdated(object sender, OdbcRowUpdatedEventArgs e)
        {
            object[] items      = e.Row.ItemArray;
            string   itemString = ">" + items[7] + "x" + items[1] + "\"" + items[2] + "\"(Aritkelnummer" + items[0] + "),Größe:" + items[3] + ",Farbe:" + items[4] + ",Einzelpreis:" + items[5] + "EURO";

            if (e.Status.Equals(UpdateStatus.ErrorsOccurred))
            {
                e.Status = UpdateStatus.SkipCurrentRow;
                Console.WriteLine("Update für diese Zeile nicht ausgeführt:\n" + itemString);
                message += "\n";
                message += itemString;
            }
            else
            {
                OdbcCommand odbccmd = getInsertCommand(e.Row); //.CommandText, odbcConnection1);
                //odbccmd.ExecuteNonQuery();
                Console.WriteLine("Update für diese Zeile ausgefürt:\n" + itemString);
                Console.WriteLine("Insert-Anweisung:\n\t" + odbccmd.CommandText + "\n");
                try
                {
                    var T = odbccmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.GetType() + Environment.NewLine + ex.Message);
                }
            }
        }
示例#2
0
        private void odbcDataAdapter1_RowUpdated(object sender, OdbcRowUpdatedEventArgs e)
        {
            Console.WriteLine("SQL-Anweisung = " + e.Command.CommandText);
            Console.WriteLine("Statementtyp = " + e.StatementType);

            Console.WriteLine("Updating-Status = " + e.Status);
            //Console.WriteLine(e.Row.Table);

            //Console.WriteLine(e.Errors.HelpLink);
            //Console.WriteLine(e.Errors.HResult);
            //Console.WriteLine(e.Errors.InnerException);
            //Console.WriteLine(e.Errors.Message);
            //Console.WriteLine(e.Errors.Source);
            //Console.WriteLine(e.Errors.StackTrace);
            //Console.WriteLine(e.Errors.TargetSite);
            object[]      items = e.Row.ItemArray;
            StringBuilder sb    = new StringBuilder();

            for (int i = 0; i < items.Length; i++)
            {
                sb.Append(items[i]);
                sb.Append("");
            }
            if (e.Status.Equals(UpdateStatus.ErrorsOccurred))
            {
                e.Status = UpdateStatus.SkipCurrentRow;
                //Console.WriteLine("Update für diese Zeile nicht ausgeführt:\n\t" + sb.ToString());
            }
            else
            {
                //Console.WriteLine("Update für diese Zeile ausgeführt:\n\t" + sb.ToString());
            }
        }
示例#3
0
 /// <devdoc>
 /// Listens for the RowUpdate event on a dataadapter to support UpdateBehavior.Continue
 /// </devdoc>
 private void OnOdbcRowUpdated(object sender, OdbcRowUpdatedEventArgs rowThatCouldNotBeWritten)
 {
     if (rowThatCouldNotBeWritten.RecordsAffected == 0)
     {
         if (rowThatCouldNotBeWritten.Errors != null)
         {
             rowThatCouldNotBeWritten.Row.RowError = SR.ExceptionMessageUpdateDataSetRowFailure;
             rowThatCouldNotBeWritten.Status       = UpdateStatus.SkipCurrentRow;
         }
     }
 }
示例#4
0
 /// <summary>
 /// 处理 DataAdapter 实例的数据更新错误处理方式。
 /// </summary>
 private void OnRowUpdated(object sender, OdbcRowUpdatedEventArgs args)
 {
     if (args.RecordsAffected == 0)
     {
         if (args.Errors != null)
         {
             args.Row.RowError = args.Errors.Message;
             args.Status       = UpdateStatus.SkipCurrentRow;
         }
     }
 }
示例#5
0
 /// <summary>
 /// Handles the RowUpdated event
 /// </summary>
 /// <param name="obj">The object that published the event</param>
 /// <param name="e">The OdbcRowUpdatedEventArgs</param>
 protected void RowUpdated(object obj, OdbcRowUpdatedEventArgs e)
 {
     base.RowUpdated(obj, e);
 }
示例#6
0
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// odbcrowupdatedeventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this OdbcRowUpdatedEventHandler odbcrowupdatedeventhandler, Object sender, OdbcRowUpdatedEventArgs e, AsyncCallback callback)
        {
            if (odbcrowupdatedeventhandler == null)
            {
                throw new ArgumentNullException("odbcrowupdatedeventhandler");
            }

            return(odbcrowupdatedeventhandler.BeginInvoke(sender, e, callback, null));
        }