Questions tagged [ado.net]
ADO.Net is commonly used by programmers to access and modify data stored in relational database systems, though it can also access data in non-relational sources. It is a part of the base class library that is included with the Microsoft .NET Framework.
ado.net
10,105
questions
0
votes
2
answers
113
views
Can't update data source with DataAdapter
I am experimenting with DataSets and DataAdapters in Visual Studio. So, I have a toy table (teacher) in MySQL with two columns: id (PK) and AM (int(11)). In a WinForm, a textbox is bound to AM:
string ...
0
votes
0
answers
13
views
Strange error when calling RANDOM function in Teradata from .Net
I have the following piece of code:
try
{
var con = new TdConnection("....");
var com = new TdCommand("SELECT MyID, RANDOM(?, ?) FROM MyTable", con);
var p1 = new ...
0
votes
1
answer
46
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())
{
...
1
vote
1
answer
59
views
Can we use any other alternative instead of using ADO.NET to access stored procedures?
Currently I'm using ASP.NET MVC for an ongoing application, to use the stored procedures I'm using ADO.NET. Is there any other way to call stored procedures from the code rather than using ADO.NET ?
...
0
votes
2
answers
113
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 ...
0
votes
2
answers
79
views
Linq how can do null check in where clause?
This is simple linq query
datetime dob = "05152024";
var query = from row in maxLookupData.AsEnumerable()
where row.Field<DateTime>("bar")) <= dob
select row;
In ...
1
vote
1
answer
55
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
51
views
Extract the curent username C# , Forms
I made an application in Winforms c# with ado net and it has a form for creating an account but also for logging in, the idea is that after a person enters his data and creates his account or logs in, ...
0
votes
0
answers
25
views
ASP.NET Page_Load event firing twice
I'm encountering an issue where the Page_Load event in my ASP.NET web page seems to be firing twice, leading to unintended behavior. I have a Page_Load event handler that's supposed to bind data to a ...
0
votes
1
answer
60
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 ...
0
votes
0
answers
41
views
C# .NET Core Unit Test data access layer method that use SQL Connection and SQL Command - could not mock this concrete class
The data access layer code has couple of method for fetch and update. please find sample that has one method. I need to write unit test. The challenge I face is I'm unable to mock SqlConnection and ...
2
votes
1
answer
81
views
System.Data.SQLite: Check SQLite database is not empty (has at least one row in any table)
I need to check with System.Data.SQLite library that my SQLite database is not empty (has at least one row in any table). For now I get table names from sqlite_master table and then query each table ...
0
votes
1
answer
47
views
SqlTransaction is disposed unexpectedly when SET IDENTITY_INSERT fails
I am facing an issue with SqlTransaction, where the transaction object is rolledback and disposed unexpectedly. This seems to specifically occur when SET IDENTITY_INSERT is called on an unknown table. ...
0
votes
0
answers
21
views
Unit Test for Dotnet Core ADO.NET DataAccessLayer in C# using Xunit
Can you provide XUnit Test for this cass
public class DataAccessLayer : IDataAccessLayer
{
private readonly string _connectionString;
private readonly ILogger<DataAccessLayer> _logger;
...
1
vote
1
answer
93
views
Adding list of GUIDs as SqlParameters to filter to perform IN operator [duplicate]
I am trying to pass a list of GUIDs as SqlParameters to execute a query using IN operator. But the result is empty even though some of the provided GUIDs are valid as exist in the table.
Here is an ...