Tag: .net

SQL Server: Inconsistent results of IF statement

I am doing a data migration and I am currently implementing a reverse-script for our worst case scenario. I might be a little bit tired now but I canĀ“t get my head around this thing – so maybe you can help. I have the following SQL: IF NOT EXISTS(SELECT * FROM sys.columns WHERE Name = […]

Interpreting byte in stored procedure

A proc we have searches an encrypted field by encrypting the search field and comparing these encrypted values. What I need though to be able to do is to pass into the proc (through Entity Framework 4) the encrypted value (as the code encrypts it), but also allow null if the value is not provided. […]

Get columns size along with column name and datatype

I am trying to fetch columns, datatypes and size of columns of selected table and database from sql server database. So far I am successfull in fetching column names and datatypes but I want to fetch size also. Example: Consider I have 2 columns in sql server database tables like below: 1) Name nvarchar(30) 3) […]

Randomly slow page loading

It’s not easy to explain what the problem really is, but I try to ;-). Here’s some data: Microsoft Server with IIS7 (not RC2) 3GB Ram Only this application is on this server SQL 2008 Express Repository Pattern SimpleInjector MVCSitemapProvider Ok now to the problem. It’s not the startup because the site is loaded in […]

How to achieve functionlity i.e. controlling “Incr Pool Size” or “Decr Pool Size” while establishing connection to SQL? similar to ORACLE

I have asked a question about “Incr Pool Size” or “Decr Pool Size” How to resolve SqlConnection error "Keyword not supported: 'decr pool size'." This is another but different question related to that , in brief ORACLE connection string provides these two option to increase/decrease connection objects when connection pool is empty or full respectively. […]

Read both underlying and uncommitted transaction data

Using SQL Server from .NET, is it possible (using the same or separate connections) to read both the underlying data as well as the as-yet uncommitted changes from another separate connection? For example: I have Connection1, which starts a transaction and inserts a record with Id == 1 into a table but doesn’t commit it […]

This SQL code works when being executed in SMMS but not when called via ExecuteNonQuery() in .Net why?

I suppose this is a very minor thing, but I seem to not see it. I have a script that sets up some views and indices in an already existing database (column and table details should not matter for this question…) USE <dbname> GO CREATE VIEW [dbo].View1_ WITH SCHEMABINDING AS SELECT [someTable].[Id] FROM [dbo].[someTable] WHERE […]

Update listbox on time asp.net

I have a listbox that is getting data from the database . My problem is that i want to refresh that list box on every 3 seconds for example or some n seconds. Is this possible in ASP.Net can i update listbox on time without refreshing whole page? and if it is possible how can […]

How can I add data from DataTable to database table directly?

How can I add data from a DataTable to a database table directly? I have searched on the internet not being able to get information from any site. I have a DataTable and now I want to add that data to a database table. importData.Tables[1]; for(int r = 0; r< totalrecoreds; r++;) { Array test[] […]

SQL Scripts from dotnet with transactions

I have been trying to execute sql scripts from dotnet (C#) but the sql scripts could contain GO statements and I would like to be able to wrap the collection of scripts in a transaction. I found this question and the accepted answer got me going for handling the GO statements, but if I use […]

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