Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [c#]

C# is a general-purpose, managed, garbage-collected, object-oriented programming language created by Microsoft.

1
vote
4answers
661 views

Load testing: The performance of a query is decreasing as the number of parallel executions is increasing

I'm seeing a slow down when doing load testing on my app. I have a query that takes about 350ms to run, but what I run it in parallel 8 times (not to mention 32 times), it goes up to 2.5 seconds. I ...
-1
votes
1answer
1k views

Can't connect to LocalDB from Visual Studio 2015

When I try to connect to the database, to which I was previously able to connect, I get the following error: I tried to solve this by looking up other stackoverflow questions and online resources, ...
0
votes
2answers
701 views

fetching Remote table data and storing into local dump file in pgSQL? [duplicate]

I want to copy one table's content from a remote machine to local. I have tried with psql Command \copy. It's working fine as "copy" is not working due to copying from remote. But is there any way I ...
0
votes
1answer
200 views

In which extent can I use the Oracle Data Provider for .NET Managed Driver?

Good evening everybody, I am planing to dive into the oracle database world. Additionally, I want to develop some tools, which make my life easy by checking and modifying information in different ...
0
votes
1answer
50 views

Best way to store products of Multiple Fields of different information

I have around 6 table in one of 3rd party cloud database. I am planning to Build it MSSQL. My problem in each of these table there are 20-40 field of different information and Item. Which approach ...
1
vote
1answer
146 views

Creating a Windows database backup service [closed]

I am creating a Windows service in C# that will run on our system to run a backup between 3am and 5am on our databases. I have started by creating a method that will basically run the backup when SQL ...
1
vote
1answer
2k views

Service Broker activation procedure in C# with external dependencies

I am not entirely sure if I have come to the right place, because this question involves both SQL Server and .Net. Apologies if this is not an appropriate place for my question! I am currently ...
5
votes
2answers
1k views

What's the best practice of inserting a collection of data into a SQL Server database

I am using C#, Entity Framework. SQL Server for the development. I have a method which has two parameters (int ID, List<String> _listobj). For each ID, there is a list of obj. All of these IDs ...
0
votes
1answer
441 views

How to make SQL Server order fields by 'Id' (which in this case is an Identity column)

I have an SQL Server table that i post into using C#. I would like the fields to be ordered using Id. Instead i get something like this: I need the id column to be arranged in order of increasing ...
1
vote
2answers
479 views

Understanding connection string syntax

I am following How To Create a SQL Server Database Programmatically but find limited resources explaining the syntax is greater detail other than MSDN: Filegroup Options. Take the following code on ...
2
votes
0answers
383 views

Intermittent IOExceptions when connection with MySQL Connector/Net. Why?

I have a web application which uses a MySQL 5.7.13 server for storing its data. MySQL is running on Windows Server 2008 R2. A couple of month ago I started seeing exceptions like the following being ...
2
votes
0answers
841 views

Using C#, is there a method to restore a database from a multi-file backup detecting which files are full vs diff?

I know there is functionality to restore databases in C#, however if I am given 2 or more files in a directory containing a full and differential backup files I would like to: 1) Determine which file ...
0
votes
1answer
56 views

Check for existing matches to find the field their grouped-by

So I have a table of values associated with different sessions using a field called sessionid, lets say the table has 3 other fields: itemcode, itemcost, & itemeffect. What I end up doing, is ...
2
votes
1answer
2k views

Handle concurrency on sql server for a booking system

I've been banging my head against the wall trying to solve this problem and I couldn't come up with a solution that absolutely guarantees two users can't book an appointment for the same time. The ...
0
votes
1answer
3k views

Change the default version of MSSqlLocalDB for Visual Studio 2015

I am working on a C# project with SQL Server. For development, we use LocalDB instance of SQL Server. If something is changed in the database, we check-in the .mdf/.ldf files into TFS. The connection ...
4
votes
3answers
7k views

What's the most efficient way to load a csv file into SQL Server 2016?

Alright, so this question seems simple up-front. Well, there's a bit more to it than just loading the file. The entire story goes like this: For some reason, our client sends us what can only be ...
5
votes
1answer
1k views

Can a SELECT with SELECT Subquery cause deadlock with Update query in SQL Server?

I am using entity framework with table per type. I have a table called ins_GameAppInstances that has a discriminator column for the type of object I am returning. There is another table that has some ...
1
vote
1answer
5k views

Transaction (Process ID 56) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction

I received the error that is in question, but do not have a north where to start investigating the cause of this error, ie not a North where to start. I'm getting worried about the situation. can ...
2
votes
1answer
1k views

Why are Column Defaults on my User-Defined Table Type (UDTT) not being honored?

I create a table type in SQL: CREATE TYPE [dbo].[MyObject_TableType] AS TABLE ( [Name] VARCHAR(MAX) DEFAULT '', [Index] VARCHAR(MAX) DEFAULT '' ) I build a DataTable and populate it with one ...
1
vote
1answer
65 views

How to check programmatically which replica I'm connected to

I have an AlwaysOn Availability Group on MS-SQLServer (2 replicas) and a C# application which sends queries to the Availability Group Listener. How can I check which replica is responding my queries? ...
0
votes
1answer
72 views

Query for a single unique record takes about 1.5 seconds

I have a simple table with a 13 byte unique key (indexed unique, non-clustered) and about 6 other small fields of no more than 10 bytes each. The table has about 8 million records. I have rebuilt the ...
0
votes
1answer
25 views

Performing group by, Order by on a table starting from particular date to recent last date [closed]

Am sorry if this question sounds so dumb, please help. I currently use the below MS SQL query to get the list of volunteers on each date and it works perfectly fine, select Date, count(id) as co ...
3
votes
2answers
634 views

Table with only a single constant value?

I use C# entity framework code first. My knowledge regarding databases is almost nothing. I don't know if it's common or good practice so I wanted to ask you guys how I should do it. Say I have a ...
4
votes
1answer
3k views

DROP DATABASE statement cannot be used inside a user transaction

Not really sure if this question belongs here, but I hope someone could help me out. I've made integration tests going all the way down to the database (using mssql localDB). I want each test to run ...
0
votes
1answer
409 views

Matching separate unicode characters as one

I am writing a C# program, and I'm querying a SQLite database. I have multiple diacritical characters (e.g ã, õ, ó, ê) which I need to match in my search. I have the command "SELECT * FROM ...
0
votes
0answers
85 views

What is the difference between Microsoft SQL Server 2008 R2 and MySql Server 5.6 for handling Select ISNULL(MIN(StartDate, '1/1/1900 10:00'))?

I would like to know the difference between Microsoft SQL Server 2008 R2 and MySql Server 5.6 for parsing the following SQL statements. Microsoft SQL Server 2008 R2 SELECT ISNULL(MIN(StartDate),'1/1/...
1
vote
1answer
627 views

C# ASP.net MVC - Which way is more efficient and quicker to store data into database?

I am using Microsoft Visual Studio and C# language to query and store data into my database. I have two ways in which I can store data into my database in SQL server. For example, I need to store ...
3
votes
1answer
1k views

CLR Procedure with XML parameter returns Data at the root level is invalid. Line 1, position 1

I have following CLR stored procedure, which is throwing error on this command xmlDoc.LoadXml(inputXml); code public static int spGetTaxOfficeXML(SqlXml _inputXml) { // this ...
1
vote
2answers
281 views

Encrypted column - limit key access

I'm new to SQL encryption and have a SQL Server 2012 database. The database itself needs to be accessible by DBAs but the data within one of the columns a table should only be viewable in plain text ...
2
votes
1answer
2k views

Table name starting with @

There is a table in my database that starts with the @ symbol. I am able to query it successfully using the following query: select * from [@tablename] This format works in SSMS and Crystal Reports....
0
votes
2answers
2k views

Database Design - Voting System

I'm creating a website in which people can submit there own lists, and then essentially others Up/Down Vote the items within the list. I'd like the list (If the submitter allows "votes") to be ordered ...
1
vote
1answer
561 views

Could I use the SQL statement, SELECT * from sysobjects, with C# MySQL Connector - .NET?

I would like to port a SQL statement, SELECT * from sysobjects, written for Microsoft SQL Server to MySQL version 5.6. Could I use the SQL statement, SELECT * from sysobjects, with C# MySQL ...
4
votes
2answers
345 views

How to deal with Users Needing to Enter Mixed Data Types in MS SQL Server

I have a form in a C# application that I can't change with a data table bound to a query. The user enters a mark for a student's task or 'A' for absent. However, the person who designed this had the ...
0
votes
1answer
441 views

Could I set my InnoDB MySQL Server session state for SQL_SAFE_UPDATES and INNODB_FLUSH_LOG_AT_TRX_COMMIT?

Could I set my InnoDB MySQL Server session state for SQL_SAFE_UPDATES and INNODB_FLUSH_LOG_AT_TRX_COMMIT using MySQL Workbench's SQL Query window or MySQL Connection Navigator instead of in a c# Mono,...
1
vote
1answer
62 views

Database role to allow .NET program to retrieve MSDB table and view rows

I'm currently writing a database management application that connects to all of my databases and returns metadata for each database. The user currently has db_datareader role for MSDB but the ...
2
votes
1answer
367 views

SQLCLR assembly throws error when multiple queries run simultaneously

I have been using SimMetrics to implement the QGramsDistance search in SQL Server. The SimMetrics is used as a SQL CLR assembly. The search results are promising and everything was well, until of late,...
1
vote
2answers
499 views

How to copy data from one database to another database efficiently?

I have a conceptual question. I have two databases which theoretically have the same structure but one of them is a SQLBase database and the other one is a SQL Server database. One database (the ...
2
votes
1answer
377 views

SMO Copy database or remove all non-system database objects

I have c# SMO script which copy all database objects to existed empty database or to a new database. But this approach has two problems Existed database is not empty, manual intervention is needed. ...
6
votes
2answers
575 views

SQL server Database statistics degrading after execution

I have been experiencing timeouts while querying my SQL Server DB in particular one table. I tried updating the statistics and it fixed the performance issues for a couple of days. I started digging ...
-3
votes
1answer
947 views

Unable to connect to SQL server 2008 R2 via computer name [closed]

I wrote a program, on my computer it works correctly because SQL Server us running on my computer, but another computer in the network can't use the database. Here is the definition of the connection ...
4
votes
2answers
688 views

Timeout expired SqlException for complex Procedure

I use Sql Server 2008 R2 and ASP.NET 4.5. Sometimes, I get this error when I executed a complex procedure: System.Data.SqlClient.SqlException Timeout expired. The timeout period elapsed ...
2
votes
0answers
124 views

Splitting very large working table

I read the good posts here and here, but my scenario is a bit different, I cannot consider that older data becomes read-only data because any record in my Transactions table can be subject to updates ...
-4
votes
1answer
5k views

Entity Framework C#: Get rows between two dates [closed]

I have an SQL server database with a column named "Time" of format "datetime". In C# Entity Framework, I want to get all rows whose date is after 8am of today: using (var db = new ...
0
votes
1answer
56 views

How can I optimize my SQL Query (Multiple Rounds)

I'm try to round the sum of every month for the current und and last year. But with thousands of entries this query is slow. How can I optimize it? I want to use the results in a C# Application. The ...
0
votes
1answer
675 views

Derived classes with same base class and class specific ids

I have three classes in my project. One base class and two derived classes. public class Animal { public long Id { get; set; } public DateTime Created { get; set; } public string Name { ...
0
votes
0answers
70 views

MySQL database hangs but less CPU

I create an application for 30 concurrent users using C# and InnoDB of MySQL (mysql-5.1.35). The size of database is more than 100M lines (~20GB). Most of data is come from 7 active table (2M lines/...
1
vote
0answers
335 views

How to create a stored procedure to update database after table edit

In a C# website application with a database, I set a gridView table so that I could edit the values in the table by row, but it appears that I need a stored procedure to do that. Below is the stored ...
1
vote
0answers
888 views

Is there a way of implementing a composite primary key with varying fields in MongoDB?

Here is the information about my development environment: -Mongodb 3.0.0 -Microsoft Visual Studio Professional 2013 -.NET Framework 4.5 We are trying to design some MongoDB collections at work ...
-2
votes
1answer
183 views

Why are writes failing in MongoDB?

Here is the information about my development environment: Microsoft Visual Studio Community 2015 .NET Framework 4.6 ASP.NET MVC assembly System.Web.Mvc Version=5.2.3.0 MongoDB.Driver 2.0.1.27 ...
0
votes
1answer
2k views

ERROR: Failed to convert parameter value from a String to a DateTime

I have faced this error: Failed to convert parameter value from a String to a DateTime when trying to pass multiple selected dates from checkboxlist to my parameter to be used in sql. I have tried ...