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

learn more… | top users | synonyms

3
votes
1answer
71 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 ...
-1
votes
1answer
25 views

Copy tables from SQL Server on another PC to my SQL Server database [on hold]

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 ...
1
vote
1answer
39 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
311 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 ...
1
vote
1answer
304 views

SSIS append trailer with Script

I am trying to add a footer to a flat file output. I have 2 data flows in my control flow. One creates the file from the DB. It goes from OLE DB Source to Flat File Destination. The second control ...
0
votes
1answer
211 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
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 ...
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
2answers
67 views

Searching a database safely using SELECT

I have a site that allows users to search the database for several items. However I am not that good with SQL and I have read that allowing user to type in boxes that then use "SELECT-statements" is ...
3
votes
2answers
117 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 ...
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
1answer
141 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 ...
2
votes
3answers
9k views

SQL Server 2012 - Insufficient memory to continue the execution of the program. (mscorlib)

I have a sql file, which is up to 180 Mb. When I try to open and execute it on Microsoft SQL Server Managment Studio 2012, I am getting this error. . What do do ? I researched on Google. And there ...
5
votes
2answers
491 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 ...
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 ...
1
vote
1answer
131 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 ...
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
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 ...
3
votes
1answer
113 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 ...
10
votes
3answers
9k views

3rd party dll in SQL Server CLR

I need to use a third party DLL in a trigger c# code in SQL Server CLR But when I try to add reference it just shows some DLLs from SQL Server. How can I add my third party dll to SQL Server?
1
vote
1answer
132 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
112 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
43 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
67 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
88 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 ...
6
votes
2answers
127 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 ...
1
vote
1answer
41 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 ...
16
votes
3answers
818 views

Setting up a central CLR stored procedure / function respository library for internal stored procs in other databases to use?

I would like to use code that I developed in C# CLR to be used in all of the databases on the system so that I don't have to set each to trustworthy and turn CLR on and keep a bunch of the same code ...
2
votes
1answer
94 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. ...
3
votes
1answer
361 views

SSIS 2012: What rights are needed to connect to SSDB via DMO

I'm trying to connect to the SSDB catalog to execute a package using the .NET object model e.g. using Microsoft.SqlServer.Management.IntegrationServices; var sqlConn = new SqlConnection(...
-3
votes
1answer
240 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
72 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
72 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
517 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
113 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
130 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 { ...
5
votes
2answers
579 views

Best Practices for Creating and Deleting Records in MYSQL

I'm fairly new to working with databases, but I've currently have a webCrawler that I've written in C# using MYSQL database. The crawler is frequently writing and deleting records from the database ...
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
83 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
93 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
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 ...
5
votes
1answer
1k views

System.Data.Entity.Infrastructure.CommitFailedException: C# Multithreading & SQL Server 2012

We have a C# multi threaded (100 threads) program which reads the records from the DB and each thread picks up one record (one Entity Framework connection per thread) and update the a single DB table. ...
1
vote
1answer
502 views

SSIS import with header record

I have fixed length text files that I have to import into SQL Server daily. These files contain header records (01) and Detail records (02). I am trying to build an SSIS package to do this. I have a ...