Questions tagged [c#]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
274 views

Arithmetic Overflow at RunningPackages (SSIS) problem [closed]

I've developed an SSIS Package with the C# Code.All the Package were running fine.But for the past 2 days, we are experiencing public void Main() { // TODO: Add your code here ...
2
votes
2answers
48 views

Report individual changes to data

I need to produce a daily extract on the individual changes to a dataset. So, there are 14 tables containing product and customer information and the extract must only show records from each table ...
3
votes
1answer
2k views

Unable to connect using Azure AD Service Principal on SQL Server

I'm having trouble testing a connection to Azure SQL Server using SSMS with an active directory service principal. I have an AD Admin account created, and have successfully added a colleague's AD ...
4
votes
2answers
744 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 ...
7
votes
2answers
1k views

Why can't C# SMO see extended properties on a column but Powershell SMO can?

I am attempting to read extended properties on tables and columns in a winforms C# application. I am using SQL Server SMO to do so. When I execute the application it does not see the extended ...
-3
votes
1answer
104 views

SQL Server database chooser

I remember I used to use a tool that displayed a form so that any reachable database could be selected, like the initial prompt when you open SSMS. I don't remember if it's a StackOverflow tool, ...
1
vote
2answers
540 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
0answers
506 views

What to do when you find slow running query?

I have two databases. One with 10.000 rows and one with 10 million rows. I have a load test and I am running it towards a rest api endpoint. This endpoint does a query to database and average ...
1
vote
2answers
2k views

Getting the metadata about a Query and a Stored procedure in SQL Server

I would like to get all the names of the columns in a given query [SQL Textual Query] and also the columns that are in the SELECT clause in a Stored Procedure. Is there any ways other than using ...
-1
votes
2answers
569 views

Get compressed data from sql server database to application

I have created a C# application. I have used sql server database for this application. When i run the application it communicate with the sql server and retrieve data. My problem is that when ...
2
votes
1answer
848 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 ...
1
vote
2answers
3k views

c# Backup sql server database, error Operating system error 5(Access is denied.)

I have been trying to backup an sql server database, and I understand that this error is in regards to drive write protection. I am at the end of my rope with this, as nothing that I have found online ...
1
vote
1answer
2k views

Asynchronous database inserts from C# always result in a deadlock

I'm hoping this doesn't come off as too amateurish, but I'm converting a synchronous program to run asynchronously. So far, I've gotten everything running asynchronously except database inserts. ...
0
votes
1answer
367 views

Query fails from application but runs fine in SSMS

I have a query that runs fine when executed from SSMS but when done so from the application, it fails with a (database level) exception. select ksprintid from kshistory_akt h where cast(h.serialno as ...
3
votes
2answers
567 views

Can add one CLR function to SQL server but not a second in the same assembly: loading wrong DLL

With the following code, I used csc to compile the dll. I then added the assembly to sql server 2014 using CREATE ASSEMBLY ReplaceMultiWord from 'd:\bcp\ReplaceMultiWord.dll' WITH PERMISSION_SET = ...
14
votes
3answers
19k 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?
2
votes
1answer
401 views

SELECT COUNT(*) returns no data SQL Server 2012

I have a query, that as far as I know has failed exactly one time. It's a simple select count(*) from one table, no joins. But at least this once, executing that query resulted in no data read from ...
3
votes
2answers
2k views

A Dynamic where clause in MS SQL Server

The Problem My SQL Server database contains a view that looks like the following: +-------------+-----------+------+-------+------+------+ | CAR_ID | MAKE |COLOR | Miles | Seats| MODEL| +--...
0
votes
1answer
67 views

Procedure returning different values

I have a procedure TempSalesUpdateID which gets all ProductName's column in TempSales table and set it's corresponding ProductID. ALTER PROCEDURE [dbo].[TempSalesUpdateID] AS UPDATE T SET T....
2
votes
1answer
127 views

150 External flat files used to create internal DB

I have a situation in which I must create an entire DB off of ~150 external txt files (pipe delimited) which all represent unique tables. Furthermore these txt files come in daily and need to be ...
4
votes
3answers
8k 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 ...
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
4answers
736 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 ...
3
votes
4answers
56k views

Converting varbinary data to varchar in SQLServer leads to unexpected results

I need to fix some data conversion issue in SQL server 2008. I got some requirement change on storing the data. Without much care I converted existing varbinary data to varchar using CONVERT(NVARCHAR(...
14
votes
1answer
7k views

Are we required to handle Transaction in C# Code as well as in stored procedure

Do we really require transaction handling in c# as well database store process both side C#: Using(transaction with transaction scope) { Execute stored proc; Transaction. Complete; } SQL ...
5
votes
1answer
2k 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(...
-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
780 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 ...
2
votes
2answers
2k 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(...
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
156 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 ...
0
votes
1answer
877 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 ...
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 ...
6
votes
4answers
81k views

Login to SQL Server using Windows Authentication

I have an (.Net Console App) EXE which connects to various SQL databases using SQL server Authentication with appropriate credentials. Now there is change required in the EXE to use windows ...
2
votes
0answers
906 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
498 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
518 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 ...
3
votes
2answers
925 views

SQLCLR TVF that calls web service is getting error 401: Unauthorized

I am calling a web service from a SQLCLR TVF in SQL Server 2008 R2. On the IIS server this service has open permissions. When tested using GET or POST requests on a browser the web service works as ...
1
vote
2answers
74 views

Identifying Unused \ Garbage Objects of a database

How do I find in use db objects from all application pages is there any tool or trick I can use, just like we do search in Visual studio for an object in entire solution
0
votes
1answer
57 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 ...
4
votes
2answers
398 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 ...
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 ...
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 ...
3
votes
1answer
2k 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
68 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
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 ...
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 ...
3
votes
2answers
6k 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 ...