10,112 questions
-2
votes
1
answer
101
views
Why C# program (MySQL Connector/NET, .NET 8.0) compile on command prompt with csc, but not in Visual Studio 2022?
I am a novice programmer. I want to work in my 'Windows 10' with MySQL Community Server 8.4 from a C# program (platform .NET 8.0). I am using the Visual Studio Community 2022. I also use MySQL ...
0
votes
1
answer
81
views
Get original DataRow from GetChanges()-Table
I have some sort of undo functionality in my application. I remove a row from the GUI an could undo or commit it through the underlaying DataTable-functions RejectChanges or AcceptChanges. But when I ...
-4
votes
1
answer
197
views
Populate a DataTable row with the primary key after an Insert into a SQL Server table
I have a DataTable in C# with a primary key column that is using negative numbers to auto increment. When I update the back end, I cannot figure out how to get the primary key from the database into ...
0
votes
0
answers
21
views
In SSIS using an ADO.NET Connection - setup Password so's ignored with Integrated Authentication but works with Password Authentication
In SSIS I'm using an ADO.NET connection and depending on the Target it'll either use "Active Directory Integrated Authentication" or "Active Directory Password Authentication". I'...
1
vote
1
answer
81
views
DataTable.Load not returning data of all result sets
I am writing a method in .NET 8 with C# to execute query and load a list of data tables asynchronously.
Here is the code I am using:
static async Task Main(string[] args)
{
var sql = @"
...
2
votes
3
answers
297
views
SqlConnection.Open works for System.Data.SqlClient and fails for Microsoft.Data.SqlClient with same connection string
I upgraded a library from .NET 4.7 to .NET 8.0.
In doing so, I had to update my System.Data.SqlClient references to Microsoft.Data.SqlClient.
I have both projects open, in different VS sessions, side ...
0
votes
0
answers
90
views
Data doesn't show up in the datagridview in C#, only columns show up
I am trying to display data from a SQL Server database in a C# datagridview, but only the column headers are displayed and not the data itself. I checked the SQL Server database that I am connecting ...
1
vote
1
answer
154
views
Why does this approach with TarWriter use alot of memory with Streams for files?
I originally posted this question:
how-can-i-create-a-tar-file-in-memory-from-several-varbinarymax-columns-stored which was helpful. But I realized we might need to create large .tar files, with files ...
2
votes
1
answer
90
views
Parameter for a column that contains a dash in its name
I am using Dapper with SQLite.
I have a table that is defined like so:
CREATE TABLE Example (
id INTEGER NOT NULL,
"some-field" TEXT
);
I wrote a console application in ...
0
votes
1
answer
111
views
Microsoft.Data.SqlClient.SqlException encountered while trying to call/execute a stored procedure in a .NET Core project
I am trying to call a stored procedure (that needs an input parameter) through ADO.NET code.
The exception I get is as follows:
Microsoft.Data.SqlClient.SqlException (0x80131904): Could not find ...
0
votes
0
answers
32
views
Workaround to set default value for a Guid column in a strongly typed DataSet
Steps to reproduce issue:
In Visual Studio, in a new .Net framework app, add a new strongly typed DataSet (xsd). Add a new DataTable. Add a non nullable Guid column, and for the DefaultValue, type in: ...
0
votes
1
answer
28
views
How to create two details section with headers separated under group header section?
I work on crystal report I face issue how to display two details section with different headers related to same group by licenserecid ?
I can display first section related to group licenserecid ...
0
votes
0
answers
134
views
SqlClient error or authentication error randomly occurring of different application. Azure SQL Server database
Sometimes I see those errors in the logs and we are not able to understand which may be the root cause:
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.GetFedAuthToken(SqlFedAuthInfo ...
0
votes
3
answers
110
views
SQL Server connection is getting established and not disposed through ADO.NET / C#
I am using the code shown here, to connect to SQL Server. This is working properly, but for the past 2 days, I am facing an issue where multiple connections (~2000) are getting opened and not getting ...
0
votes
1
answer
54
views
Finding RDBMS table relationships using SqlConnection schemas
I am writing an app in .NET 8 and using the Northwind database to generate stored-procedures, entity POCO classes, stored-procedure wrappers, controllers, etc.
Database Relationship Diagram:
In order ...
0
votes
0
answers
280
views
Error connecting to DB2 using IBM.Data.DB2.iSeries
Trying to connect to DB2 using the Nuget pkg IBM.Data.DB2.iSeries 7.1.0 by Cristopher Gunn. The program throws an exception "The type initializer for 'IBM.Data.DB2.iSeries.iDB2Trace' threw an ...
0
votes
1
answer
59
views
C# OracleCommand return multiple DataTable as Output-Parameter with a single CURSOR
I have an SQL file that looks like this:
DECLARE
V_ID_CB VARCHAR2(15) := '{V_ID_CB}';
V_X_CB VARCHAR2(15) := '{V_X_CB}';
BEGIN
IF V_ID_CB IS NOT NULL THEN
OPEN :result_cursor FOR
...
2
votes
1
answer
2k
views
Reading as 'System.Object' is not supported for fields having DataType during adapter.Fill(dataTable) postgresSQL
I have my C# code upgraded from .NET 6 to .NET 8.
This code used to work fine in .NET 6:
using (var adapter = new NpgsqlDataAdapter(sql, context.Database.GetDbConnection() as NpgsqlConnection))
{
...
1
vote
2
answers
139
views
Is it possible to not open a nested ExecutionContext in an async method in dotnet?
I have a class similar to this:
class AmbientTransaction
{
public AsyncLocal<IDbTransaction> AmbientTransaction { get; } = new();
public IDbTransaction BeginAndSetAmbientTransaction(...
0
votes
0
answers
85
views
SQL Server Compact 4.0 SELECT query with WHERE is extremely slow on empty database
I have an empty SQL Server CE 4.0 database for a User entity (guid Id, string Name and int Age):
CREATE TABLE [Users] (
[Id] uniqueidentifier NOT NULL
, [Name] nvarchar(255) NOT NULL
, [Age] int NOT ...
-1
votes
2
answers
497
views
Specify DateTime format in DataTable DateTime column type
While adding columns to DataTable we can specify which type of data the column will hold.
So this will restrict column to hold only valid date time
dataTable.Columns.Add("Date", typeof(...
0
votes
1
answer
88
views
Why is Teradata so slow to INSERT decimals and CLOBs with .NET?
I have code that's trying to load data in batch through the Teradata .Net provider. I'm using the TdDataAdapter approach as follows:
using (TdDataAdapter adapter = new TdDataAdapter())
{
...
0
votes
2
answers
142
views
Why isn't searching on an indexed column faster than a string comparison?
I was asked for a demonstration of how searching on an indexed column is faster than searching for a string prefix, so I created a quick test but the results were surprising and I can't see why.
The ...
1
vote
1
answer
108
views
Keep the connection open in Microsoft Practices EnterpriseLibrary to run multiple SPs [duplicate]
We are using EnterpriseLibrary to connect to database. I want run 2 or more SPs on same connection. I want set the context and run multiple SPs in the same session.
But when the first SP the the ...
0
votes
1
answer
125
views
how to connect ADO.NET and SQL with C++
I'm developing in C++ to which I want to add a SQL database and connect it with ADO.NET. I need to add int, string, string, string, string double, int, int to the database. And upon request, this data ...