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

learn more… | top users | synonyms

-1
votes
1answer
16 views

Copy tables from SQL Server on another PC to my SQL Server database

I want to copy a table's data from a database on another PC to my local database. Can anyone help me with that? I have a different methods of doing that but I need another method. I want to automate ...
0
votes
1answer
34 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
0answers
14 views

Better way to design self-referencing tables with undefined number of recursions to use with linq

I am about to create a self-referencing table (two columns: ID and ParentID) to use with C# and linq, and this question makes me think. Is there a better way to design self-referencing tables with ...
0
votes
1answer
60 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
115 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 ...
3
votes
1answer
132 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
17 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
24 views

Execute SSIS in C# failed; “to run a SSIS package outside of SQL Server DT you must install FTP download of IS or higher” [duplicate]

I'm trying to run a SSIS package within a C# application, which downloads .csv file from FTP server and stores it localy. The package runs fine within SQL Data Tools, but fails when called in C#, ...
0
votes
0answers
32 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
129 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
109 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
63 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 ...
1
vote
1answer
123 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 ...
0
votes
2answers
104 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 ...
0
votes
1answer
41 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 ...
3
votes
0answers
45 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
65 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,...
0
votes
0answers
85 views

MongoDB too many db.eval cause my DB can't read write

I am using C# Web API with mongocsharpdriver 1.9.2 and MongoDB 2.6.9 In my case I need performance that have to use db.eval to execute JavaScript on the server side. But I got a problem that too ...
1
vote
1answer
40 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
58 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,...
0
votes
3answers
90 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
93 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
125 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
239 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
70 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 ...
1
vote
0answers
71 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
502 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
50 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
0answers
111 views

Database design for storing historical stock exchange Level2 (depth) data

I am developing C# software using embbeded SQLite Database which shows historical level2 (market depth - asks/bids) stock exchange data graph. Example Simply speaking, there are 25 asks (price, ...
0
votes
1answer
129 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
45 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
1answer
82 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
47 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
91 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
302 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 ...
0
votes
1answer
146 views

Convert C# logic/lambda's to T-SQL

I am trying to convert the following logic in C# to a SQL Server stored procedure: C# logic // Filter by the search term if the first OR last name is null or empty // || is an 'OR' operator that ...
0
votes
1answer
208 views

How to setup sync between MongoDB and C# .NET Application

What is the best practice to synchronize a MongoDB remote database with a C# .NET App that would allow queries to be responded to within the local file system and update itself when there is a change ...
0
votes
1answer
142 views

Database structure for object with dynamic attributes

I am developing a proof of concept for a personalized email sending web application (like MailChimp, but with premade dynamic templates). The general structure is that I have my templates (different ...
0
votes
0answers
76 views

Can we swap out SQL Server with HBase on our .Net application?

In a current application we use SQL Server. The data flow consists of using TVPs for better-than-bulk-insert performance by passing in DataTables. As part of the data addition process, old records ...
2
votes
1answer
366 views

SQL Server : create dynamically queries to select all related data in DB based on entry table and ID

I'm tasked to create a SQL statement which will create (and run?) multiple other queries which will select all related data outgoing from an given ID (uniqueidentifier) and a given table name. It ...
0
votes
3answers
561 views

SSIS - Best way to insert large number of rows

So here's the scenario: I have an XML file, which is in size of 500GB, and with data of around 600 million rows (once on a database table). I'm using SSIS for the operation, and since it consumes a ...
2
votes
1answer
1k views

Select columns dynamically from sql server table

Lets say I have a table that actually store record which looks like Create Table dbo.Info ( SN int primary key identity(1,1), FirstName nvarchar(50) not null, LastName nvarchar(50) not null, ...
0
votes
1answer
19 views

Slow fill database

The source sends in my program a large number of rows. When the number of rows such as two thousand per minute for one table, all is saved in the database properly. But if you send two thousand per ...
5
votes
2answers
481 views

Can CLR execution continue after 'THROW' is encountered in T-SQL?

I am calling a T-SQL stored procedure from a CLR stored procedure. and the THROW statement in T-SQL stops the execution of CLR without going into the catch block. Is there something I can change in my ...
2
votes
2answers
83 views

CLR/C# equivalent to XACT_STATE()

I am porting a set of T-SQL stored procedures to C#/CLR. In the T-SQL, we use XACT_STATE() to determine if an error requires rolling back to a savepoint or rolling back the transaction entirely. I ...
0
votes
2answers
421 views

Grant execute on xp_logevent to sa using sa user to do it

Running a SQL Server 2012 CLR stored procedure with this code: const string executeLog = "EXEC master..xp_logevent @errorNumber, @message, informational"; using (SqlCommand cmd = new SqlCommand(...
2
votes
2answers
1k views

Sync many client database to one central database

We have client application which can be installed on local machine where users can work offline and create projects in it. This application is already developed. Now we need to create Admin ...
0
votes
1answer
272 views

Log debug messages in a SQL CLR C# Stored Procedure

I have developed a SQL CLR stored procedure in C#, for SQL Server 2012. I want to log messages to SQL Server registers. On a normal stored procedure I use xp_logevent What can I use to log a message ...
2
votes
0answers
118 views

MongoDB C# driver fails to reconnect after stepDown

I have an Elastic Beanstalk environment in AWS that constantly verifies the DB is accessible by querying the mongos for one document. We only speak to the DB routers and not to specific instances. ...