AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-1956080

gchq's questions

Martin Hope
gchq
Asked: 2025-02-07 23:35:05 +0800 CST

sqlBulkCopy WriteToServer 在计算字段上抛出错误(即使它们未包含在 INSERT 语句中)

  • 3

将数据从 SQL Anywhere 移动到 SQL Server,经过几次故障后,一切进展顺利,直到我收到错误

无法修改列“A_Future”,因为它是计算列或 UNION 的结果’

公平地说,我正在从 SELECT * 插入数据——因此使用它仅返回未计算的列。

 'Remove computed columns from the SELECT query
 Dim DR() As DataRow = MSSQLDT.Select("Computed = 'N'")
 Dim vSelectedRows As Integer = DR.Count
 Dim vCurrentRow As Integer = 0
 strSQL = "SELECT "
 For Each Row In DR
 strSQL += Row("Name")
 vCurrentRow += 1
 If vCurrentRow = vSelectedRows Then
     strSQL += " "
 Else
     strSQL += ", "
 End If
Next
strSQL += "FROM " & vTable

这将返回以下查询字符串...

SELECT Transaction_ID, Debit, Credit, Paid, P_Description, Document_Date, Supplier_ID, Nominal_Transaction, HOA_Code, Document_Saved, Document_ID, Document_No, Supplier_Inv_No, Type, Paid_Date, Part_Paid, Open_Editing, Editing_Name, Updated_Name, Updated, Reserve_Item, Hold, eCheck_Pending, eSig_Required, eSigOne_ID, eSigTwo_ID FROM A_Purchase_Ledger

.. 并且它不包含任何计算列。再次运行,但它仍然抛出相同的错误(对于所有计算列)

Microsoft.Data.SqlClient.SqlException (0x80131904): The column "A_Future" cannot be modified because it is either a computed column or is the result of a UNION operator.
The column "A_Current" cannot be modified because it is either a computed column or is the result of a UNION operator.
The column "A_30" cannot be modified because it is either a computed column or is the result of a UNION operator.
The column "A_60" cannot be modified because it is either a computed column or is the result of a UNION operator.
The column "A_90" cannot be modified because it is either a computed column or is the result of a UNION operator.
The column "A_Older" cannot be modified because it is either a computed column or is the result of a UNION operator.

现在这没有任何意义,因为我没有尝试向其中插入数据,除非存在SqlBulkCopy我不知道的怪癖?

选择数据被添加到DataTable然后它进入这个函数

  Public Function BulkUpdate_DataMS(DT As DataTable, HOAID As Integer, IsHASoftware As Boolean, TableName As String) As Boolean
  Try
      Using Conn As New Microsoft.Data.SqlClient.SqlConnection
          If IsHASoftware = True Then
              Conn.ConnectionString = HASConString
          Else
              Conn.ConnectionString = ReturnConnStringMS(HOAID)
          End If
          Conn.Open()
          Using vTrans = Conn.BeginTransaction
              Using vBulk As New Microsoft.Data.SqlClient.SqlBulkCopy(Conn, Microsoft.Data.SqlClient.SqlBulkCopyOptions.Default, vTrans)
                  vBulk.DestinationTableName = TableName
                  vBulk.WriteToServer(DT)
              End Using
              vTrans.Commit()

          End Using
          Conn.Close()

      End Using
      Return True
  Catch ex As Exception
      EmailError(ex, 222, PageName)
      Return False
  End Try
 End Function
sql-server
  • 2 个回答
  • 81 Views
Martin Hope
gchq
Asked: 2025-02-07 02:59:58 +0800 CST

创建表计算值

  • 5

遗憾的是,SAP 放弃了 SQL,我目前正在编写一个实用程序来迁移到 SQL Server。正在创建的其中一个表有一个计算列(直接从导出的数据中获取),而 SQL Server 抛出了错误

关键字“if”附近的语法不正确

更改类型后生成的表是......

CREATE TABLE A_Invoices
(
    Invoice_ID int NOT NULL IDENTITY(1,1) PRIMARY KEY, 
    Invoice_No int, 
    Type varchar(2), 
    Invoice_Date date, 
    Transaction_Date date DEFAULT GETDATE(), 
    Customer_ID int, 
    Customer_Name varchar(100), 
    Nominal_ID int, 
    Add1 varchar(100), 
    Add2 varchar(200), 
    City varchar(100), 
    State varchar(2), 
    Zip varchar(15), 
    Terms varchar(100), 
    Amount_Net float, 
    Amount_Tax float, 
    Amount_Gross float, 
    Tax_Rate float(53), 
    Tax_Code varchar(2), 
    Settlement_Due_Days int, 
    Settlement_Discount_Rate float(53) DEFAULT 0.0, 
    Settlement_Discount_Amount AS 
        IF "Settlement_Discount_Rate" > 0 
           THEN ("Amount_Net"*"Settlement_Discount_Rate") / 100 
           ELSE 0.0 
        ENDIF, 
    Printed varchar(1) DEFAULT 'N', 
    Posted varchar(1) DEFAULT 'N', 
    Flag_Prepayment varchar(1) DEFAULT 'N', 
    Prepayment_Months int DEFAULT 0, 
    Prepayment_Amount float DEFAULT 0.0, 
    Flag_Deposit varchar(1) DEFAULT 'N', 
    Flag_Ad_Hoc varchar(1) DEFAULT 'N', 
    Customer_Order_No varchar(50), 
    Details varchar(100), 
    Pay_Due_Days int DEFAULT 0, 
    Open_Editing int DEFAULT 0, 
    Editing_Name varchar(100) DEFAULT 'System', 
    Updated_Name varchar(100) DEFAULT 'System', 
    Updated DateTime2 DEFAULT GETDATE()
);

对语法有什么想法吗?不太确定如何处理这个问题。

**更新

为了回答一些问题 - 双引号随查询一起返回SQL Anywhere。

SELECT c.column_name AS 'Name', 
c.base_type_str AS 'Type',
c.nulls AS 'Nulls', 
c.`default` AS 'Default' 
FROM systabcol c KEY JOIN systab t ON t.table_name = 'vTB' 

其中大多数表格都是从早期版本升级而来的SQL Anywhere。

感谢您的意见,它现在正在工作 - 我通过这个解决了“如果”......

If vComputed = "C" Then
vMSComputed = "Y"
If vDefault.Contains("if") Then
    Dim s As New System.Text.StringBuilder(vDefault)
    s.Replace("if", "CASE WHEN", 0, 2)
    s.Replace("endif", "END", 0, s.Length)
    s.Replace("""", "")
    vMSDefault = s.ToString

End If
Else
vMSComputed = "N"
End If

由于某种奇怪的原因,它创建了MS SQL表,然后返回错误,说它已经存在。用以下方法解决了这个问题...

IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'vTable')
sql
  • 1 个回答
  • 57 Views
Martin Hope
gchq
Asked: 2024-11-26 18:07:43 +0800 CST

当按钮文本为动态时,按钮中的 Bootstrap 微调器不起作用

  • 5

各种表单都加载到模态中,保存的数据使用按钮文本(“保存”插入新记录,“更新”更新现有记录……)下面的代码片段中有两个按钮 - “插入”和“标准” - 当启动标准模态时,微调器可以工作,但当更改按钮文本时,微调器则无法工作。有什么想法可以解决这个问题吗?

$('#insertButton').on('click', function() {
  $('#testButton').text('Save');
  $('#testModal').modal('show');
})

$('#standardButton').on('click', function() {
  
  $('#testModal2').modal('show');
})
  
<
-<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>

<script
  src="https://code.jquery.com/jquery-3.7.1.min.js"
  integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo="
  crossorigin="anonymous"></script>


<div class="container">
  <button type="button" id="insertButton">Insert</button>
  <button type="button" id="standardButton">Standard</button>
</div>





<div class="modal" id="testModal" tabindex="-1">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">Modal title</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        <p>Modal body text goes here.</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        <button type="button" id="testButton" class="btn btn-primary">
   <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>     
        </button>
      </div>
       </div>
  </div>
</div>


<div class="modal" id="testModal2" tabindex="-1">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">Modal title</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        <p>Modal body text goes here.</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        <button type="button" id="testButton2" class="btn btn-primary">
   <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>  
        Save
        </button>
      </div>

bootstrap-5
  • 1 个回答
  • 17 Views
Martin Hope
gchq
Asked: 2024-11-15 19:04:36 +0800 CST

在iText7中合并pdf数组页面

  • 5

这是我用于合并 iTextSharp 中从数据库流式传输的 pdf 文档的功能

 Public Function PDF_Functions_AddPages(PDFByteContent As List(Of Byte())) As Byte()
 Try
    Using MS As New System.IO.MemoryStream
        Using vDoc As New iTextSharp.text.Document()
            Using vCopy As New PdfSmartCopy(vDoc, MS)
                vDoc.Open()
                For Each Row In PDFByteContent
                    Using vReader As New PdfReader(Row)
                        vCopy.AddDocument(vReader)
                    End Using
                Next
                vDoc.Close()
            End Using
        End Using
        Return MS.ToArray()
    End Using
Catch ex As Exception
    EmailError(ex)
    Return Nothing
End Try
End Function

但是我在弄清楚如何使用 iText7 做同样的事情时遇到了问题。

更新

我试过

 Function PDF_AddPages(PDFByteContent As List(Of Byte())) As Byte()
 Try
     Using MS As New System.IO.MemoryStream
         Using vWriter As New iText.Kernel.Pdf.PdfWriter(MS)
             Using vMerged As New iText.Kernel.Pdf.PdfDocument(vWriter)
                 Dim vMerger As New iText.Kernel.Utils.PdfMerger(vMerged)
                 For Each Row In PDFByteContent
                     Using copyFromMS As New MemoryStream(Row)
                         Using vReader As New iText.Kernel.Pdf.PdfReader(copyFromMS)
                             Using copyFromDoc As New iText.Kernel.Pdf.PdfDocument(vReader)
                                 vMerger.Merge(copyFromDoc, 1, copyFromDoc.GetNumberOfPages())
                             End Using
                         End Using
                     End Using
                 Next
             End Using

         End Using
         Return MS.ToArray()
     End Using
 Catch ex As Exception
     EmailError(ex, 2226, PageName)
     Return Nothing
 End Try
 End Function

但这会引发“充气城堡”错误

System.TypeInitializationException: The type initializer for 'iText.Bouncycastleconnector.BouncyCastleFactoryCreator' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
  at iText.Bouncycastleconnector.BouncyCastleFactoryCreator..cctor()

...也许更接近一点了:-)

itext7
  • 1 个回答
  • 17 Views
Martin Hope
gchq
Asked: 2024-11-01 14:26:41 +0800 CST

.NET 8 上的 WPF 项目缺少“已连接服务”菜单中的“添加服务引用”

  • 5

我有一个在 .NET 8.0 上运行的 WPF。我知道 MS 凭借其无穷的智慧在 .NET core 方面忽视了 VB 开发人员,但这不是 .NET core。

.NET 核心问题链接

根据文档,添加服务引用现已从解决方案资源管理器下直接移至添加>连接的服务并选择“添加服务引用” - 但只有“服务依赖项”可用。

连接服务

wpf
  • 1 个回答
  • 28 Views
Martin Hope
gchq
Asked: 2024-10-23 18:10:33 +0800 CST

使用 Dev Tools 跟踪 jQuery 中的错误

  • 5

在 asp.NET WVC 应用程序中,打开的每个页面都会在 Edge DevTools 中引发相同的错误...

"stack": "Error: Failed to execute 'querySelector' on 'Document': ':has(*,:jqfake)' is not a valid selector.\n

...查找错误会显示一个包含整数的 ID。问题是,我如何追溯它以找到有问题的项目?它出现在每个页面上似乎很奇怪,所以必须与全局加载的内容相关。

这是 jQuery 3.7.1 和 Bootstrap 5

jquery
  • 1 个回答
  • 21 Views
Martin Hope
gchq
Asked: 2023-12-01 22:50:27 +0800 CST

Azure - 应用服务 | 应用服务计划 | 应用服务(插槽)

  • 5

这是我第一次使用 Azure,它总是发布到我们自己的服务器上,所以这是一个学习曲线 - MS 的用途就像众所周知的巧克力防火墙一样,任何文档都没有真正解释这一点。

选择 S1 层,并在 VS 中使用默认设置进行发布。由于某种原因,它创建了两个应用程序服务,而我被收取的费用是我预期的两倍。这是一个非常小的 MVC 应用程序,到目前为止带宽<0.01 美元。

我刚刚删除了那个虚假的。

现在我只剩下三项——应用程序服务、应用程序服务计划和应用程序服务(插槽)。据我了解,我可以使用相同的服务计划发布最多 10 个域,并且它将分配可用资源,但成本将保持不变(假设带宽较低)。

这给我留下了几个问题。如果我发布另一个网站,我假设这将成为第二个应用程序服务并按相同的费率收费(因此添加 10 个域会将其从每天 2.40 美元增加到每天 24.00 美元)。那是对的吗?或者我最初的想法是正确的但配置错误?每月 750 美元购买 10 个域名似乎很多。

来自 VS 我发布时有这个

Site URL -      ProjectName123456789.azurewebsites.net

Subscription -  MySubscriptionCode

ResourceGroup - ProjectName123456789ResourceGroup

ResourceName -  ProjectName123456789

我假设要发布另一个站点,我使用相同的资源组但使用不同的资源名称(因此使用不同的站点 URL)?

===========================更新====================== ========

如果我创建一个新项目(例如 MVC),然后单击发布并选择 Azure,它将选择现有设置。如果我单击+,哪里会显示“应用程序服务设置”

App Service (Windows)

Name - ProjectName987654321

Subscription Name - Same as before

Resource Group - LastProjectName123456789ResourceGroup

Hosting Plan - LastProjectName123456789Plan

它应该创建新的 MVC 站点,但以现有的收费率运行?

  • 1 个回答
  • 32 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    重新格式化数字,在固定位置插入分隔符

    • 6 个回答
  • Marko Smith

    为什么 C++20 概念会导致循环约束错误,而老式的 SFINAE 不会?

    • 2 个回答
  • Marko Smith

    VScode 自动卸载扩展的问题(Material 主题)

    • 2 个回答
  • Marko Smith

    Vue 3:创建时出错“预期标识符但发现‘导入’”[重复]

    • 1 个回答
  • Marko Smith

    具有指定基础类型但没有枚举器的“枚举类”的用途是什么?

    • 1 个回答
  • Marko Smith

    如何修复未手动导入的模块的 MODULE_NOT_FOUND 错误?

    • 6 个回答
  • Marko Smith

    `(表达式,左值) = 右值` 在 C 或 C++ 中是有效的赋值吗?为什么有些编译器会接受/拒绝它?

    • 3 个回答
  • Marko Smith

    在 C++ 中,一个不执行任何操作的空程序需要 204KB 的堆,但在 C 中则不需要

    • 1 个回答
  • Marko Smith

    PowerBI 目前与 BigQuery 不兼容:Simba 驱动程序与 Windows 更新有关

    • 2 个回答
  • Marko Smith

    AdMob:MobileAds.initialize() - 对于某些设备,“java.lang.Integer 无法转换为 java.lang.String”

    • 1 个回答
  • Martin Hope
    Fantastic Mr Fox msvc std::vector 实现中仅不接受可复制类型 2025-04-23 06:40:49 +0800 CST
  • Martin Hope
    Howard Hinnant 使用 chrono 查找下一个工作日 2025-04-21 08:30:25 +0800 CST
  • Martin Hope
    Fedor 构造函数的成员初始化程序可以包含另一个成员的初始化吗? 2025-04-15 01:01:44 +0800 CST
  • Martin Hope
    Petr Filipský 为什么 C++20 概念会导致循环约束错误,而老式的 SFINAE 不会? 2025-03-23 21:39:40 +0800 CST
  • Martin Hope
    Catskul C++20 是否进行了更改,允许从已知绑定数组“type(&)[N]”转换为未知绑定数组“type(&)[]”? 2025-03-04 06:57:53 +0800 CST
  • Martin Hope
    Stefan Pochmann 为什么 {2,3,10} 和 {x,3,10} (x=2) 的顺序不同? 2025-01-13 23:24:07 +0800 CST
  • Martin Hope
    Chad Feller 在 5.2 版中,bash 条件语句中的 [[ .. ]] 中的分号现在是可选的吗? 2024-10-21 05:50:33 +0800 CST
  • Martin Hope
    Wrench 为什么双破折号 (--) 会导致此 MariaDB 子句评估为 true? 2024-05-05 13:37:20 +0800 CST
  • Martin Hope
    Waket Zheng 为什么 `dict(id=1, **{'id': 2})` 有时会引发 `KeyError: 'id'` 而不是 TypeError? 2024-05-04 14:19:19 +0800 CST
  • Martin Hope
    user924 AdMob:MobileAds.initialize() - 对于某些设备,“java.lang.Integer 无法转换为 java.lang.String” 2024-03-20 03:12:31 +0800 CST

热门标签

python javascript c++ c# java typescript sql reactjs html

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve