Exemplo n.º 1
0
 public abstract void SubmitDataTable(DataTable datatable, SqlStruct sqlStruct, SqlOperatorType sqlOperatorType);
Exemplo n.º 2
0
        public override void SubmitDataTable(DataTable datatable, SqlStruct sqlStruct, SqlOperatorType sqlOperatorType)
        {
            if (sqlStruct.SqlString.Length != 0)
            {
                try
                {
                    this.Open();
                    SqlDataAdapter adapter = new SqlDataAdapter();
                    SqlCommand     command = this.BuildSqlCommandByStructure(sqlStruct);
                    switch (sqlOperatorType)
                    {
                    case SqlOperatorType.Insert:
                        adapter.InsertCommand = command;
                        break;

                    case SqlOperatorType.Update:
                        adapter.UpdateCommand = command;
                        break;

                    case SqlOperatorType.Delete:
                        adapter.DeleteCommand = command;
                        break;
                    }
                    adapter.Update(datatable);
                    command.Dispose();
                    adapter.Dispose();
                }
                catch (Exception exception)
                {
                    exception.HelpLink = " 相关sql语句: " + sqlStruct.SqlString;
                    throw exception;
                }
            }
        }