Tag: c#

What is the best way to reduce the size of a image that's going to be stored in SQL

Hi my ide is to store photos in an SQL Database and i want to konw how I can do to reduce the size of an image so that it dosnt take up so much space in the database. Shuld I use an alternative to SQL database or? this is my current code that i […]

Efficiently execute 100K update statements – C# & Sql Server

My C# application retrieves over a million records from Sql Server, processes them and then updates the database back. This results in close to 100,000 update statements and they all have the following form – update Table1 set Col1 = <some number> where Id in (n1, n2, n3….upto n200) “Id” is an int, primary key […]

Creating a SQL Server Express database with ASP.NET Code First

I have an existing project with a small handful of data models, and I’m trying to create a SQL Server Express database with Visual Studio 2015 and open that database in SQL Server Management Studio. I’ve enabled migrations in Visual Studio, which generated a migration Configuration.cs file that looks like this: internal sealed class Configuration […]

Estimate the size of a dataset returned from SQL

We’ve got a system that seems to be consuming a lot of data, it uses Dapper for database queries and Seq for logging. I was wondering if other than with SQL Profiler whether there was a way to add logging to Dapper to log the size of the dataset returned in MB -so we can […]

How to identify a db transaction and use it on both sides of a RPC

In our system we use transactions heavily. Our platform will automatically roll back the transaction at the very end of a request if any error messages were found in a known message collection. Because the system is very large we still have to call in to legacy code from time to time. The legacy code […]

UPDATE / EDIT SQL Database From Console C#

I’m trying to update a value in the primary key column in a sql database via console C#.I have searched the Internet for a few hours, but still cant work out why my database wont update and to make things worse I am not getting any errors to work with. static void editMONDAY() { SQLCONN.Open(); […]

Creating a Sequence of numbers in dynamically generated images using database values

I have a web app that generates barcodes. It creates the barcodes by the amount entered by the user, then generates the code using the amount, a date value, and values in a checkboxlist. The data entered by the user is then sent to a database using a stored procedure. The date values and amount […]

C# Visual Studio violation of PK for SQL Server database

I’m doing a reward system for my school project and I need help for solving my violation of PK. Anyone knows why this happens? Here’s my code (points.cs) using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; using System.Data.SqlClient; using System.Configuration; public class Points { //string _connStr = Configuration.ConnectionStringSettings _connStr; string connStr = ConfigurationManager.ConnectionStrings[“EBizDBContext”].ConnectionString; […]

How to find candian postal code between low and High by SQL Server or c#

I just want to know how to find Canada or UK postal between low and High Postal code. For Example: Low postal code: A0A0A0 and High is: A0Z9Z9 How to find postal code between these postal A0A0A0 and A0Z9Z9?

dynamically Convert SQL query to Mongo Shell scritp using C#

We are upgrading to MongoDB from SQL Server. All our writes are happening to SQL + Mongo and reads happen on MONGO. As per our application architecture, we save some SQL queries stored in a table and execute them on need. Since we now are doing all our reads from Mongo, I was wondering if […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.