All Questions
Tagged with c# sql-server
36,895 questions
-1
votes
0
answers
45
views
Getting error whenever I press delete button to delete column from SQL Server database from C# [closed]
Whenever I press the delete button, an error shows up saying
Error executing query: The DELETE statement conflicted with the REFERENCE constraint "FK1". The conflict occurred in database &...
0
votes
1
answer
35
views
Transport-level error has occurred when receiving results from the server. (provider: tcp provider, error: 0 - no such file or directory)'
using (var command = new SqlCommand("INSERT INTO TMateriales (NumMateriales, CodMateriales, NamMateriales, IslocalPMateriales, IdCategries, IsDepoMateriales, MadMateriales, PriceMateriales, ...
0
votes
0
answers
94
views
Microsoft.Data.SqlClient.SqlError: Incorrect syntax near the keyword 'AND'
This is the error I'm getting when I trye to execute the code.(https://i.sstatic.net/Z2MVQ0mS.png)
Error message: Incorrect syntax near the keyword 'AND'.
StackTrace:
at Microsoft.Data.SqlClient....
1
vote
1
answer
58
views
Dapper - Unable to resolve property
I am trying to create a create method which will insert rows into my database.
Table
This is my database table. As you can see it has an accountId column
CREATE TABLE [dbo].[Transactions](
[Id] [...
-1
votes
0
answers
68
views
A valid TLS certificate is not configured to accept strict (TDS 8.0 and above) connections. The connection has been closed
I am attempting to run a C# .NET app locally using Microsoft SQL Server via Docker Desktop. I am able to run the C# .NET successfully in VS Code and the SQL Server successfully in Docker.
This image ...
-2
votes
2
answers
55
views
Error while data passing from .NET code in form of object to SQL Server user-defined table type
I need to upload and update file bytes from C# to SQL Server, but I am getting this error in C#:
Microsoft.Data.SqlClient.SqlException: 'Implicit conversion from data type nvarchar(max) to varbinary(...
0
votes
1
answer
42
views
NLog 5.3.4 not writing logs to SQL Server table
Using an ASP.NET Core 8 Web API, I tried to implement logging to a SQL Server table.
SQL Server version used:
Microsoft SQL Server 2019 (RTM-GDR) (KB5046859) - 15.0.2130.3 (X64)
Oct 18 2024 15:25:23 ...
-1
votes
3
answers
69
views
Return multiple SQL query column and convert into tuple
I have the following code:
public async Task<(int purchaseOrderId, string PONum)> AddPurchaseOrder(PurchaseOrderMaster purchaseOrderMaster)
{
try
{
var sqlQuery = new ...
1
vote
1
answer
66
views
Include function does not work in EF Core when I inject the generic repository
I implemented this pattern so many times before, I created a context, after that I created a generic repository, like this:
public class GenericRepository<T> : IGenericRepository<T>
where ...
-2
votes
0
answers
64
views
Read an image from the database and use in an Image control [duplicate]
I am getting an image from SQL Server as object and trying to save it in a property of type Image. But I don't know how to convert an object to an image. Please help me. Thanks in advance.
...
0
votes
0
answers
56
views
Table Adapter vs SqlPipe (special case)
I have a SQL Server Server1 with a database database1 which is not normalized; this makes it harder to use for different purposes like external clients (tools for visualization, other programs, etc..) ...
1
vote
0
answers
53
views
EF Core SaveChanges error after explicit transaction
I have a code, which tries to do a certain first set of operations inside an explicit transaction, and then the rest of operations just normally.
The transaction goes okay, and gets disposed. Then ...
-1
votes
0
answers
48
views
I get an error like that "Format of the initialization string does not conform to specification starting at index 0."
I'm trying to write my first API to connect to SQL Server. I have been following all the steps from a tutorial, but I only obtain this error. I have heard this error is because the wrong connection ...
-1
votes
1
answer
44
views
Error: System.InvalidOperationException: 'The ConnectionString property has not been initialized.'
I got this error message when I tried to debug my web project:
System.InvalidOperationException: 'The ConnectionString property has not been initialized.'
I have some files to show:
Program.cs:
...
0
votes
1
answer
68
views
C# How to Group List for XML Object
I need help, for group by my XML object class.
Here my data from SQL server, my Query
( select * from TaxXMLdb ) =
TIN
DocEntryAR
BuyerDocNum
BuyerName
Opt
ItemCode
Name
DocEntryAR2
AAA
100100
5533
...