Display varbinary Image in Gridview

The following will show how to retrieve an image from SQL Server and display it in a GridView on an ASP.NET web page. Create a table in the database: CREATE TABLE Surplus([Surplus Id] int not null, Department nchar(50), Category nchar(25), Item nchar(75), Visible bit, TransferableImage varbinary(max), CONSTRAINT PK_Surplus_SurplusId PRIMARY KEY([Surplus Id])); Note: If a table … Read more

Slow query with cfqueryparam searching on indexed column containing hashes

Your issue may be related to VARCHAR vs NVARCHAR. These 2 links may help Querying MS SQL Server G/UUIDs from ColdFusion and nvarchar vs. varchar in SQL Server, BEWARE What might be happening is there is a setting in ColdFusion administrator if cfqueryparam sends varchars as unicode or not. If that setting does not match … Read more

How to import data from .csv in SQL Server using PowerShell?

I wrote a blog post about using SQL with PowerShell, so you can read more about it here. We can do this easily if you have the SQL-PS module available. Simply provide values for your database name, server name, and table, then run the following: $database=”foxdeploy” $server=”.” $table=”dbo.powershell_test” Import-CSV .\yourcsv.csv | ForEach-Object {Invoke-Sqlcmd ` -Database … Read more

Populate Dataset With Table Names From Stored Procedure

Your SP is not actually returning multiple tables, its returning a selection of columns and rows from your tables, therefore there is no ‘table name’, and hence why they are named table1, table2 etc. If its important, you could return an extra column for each selection, and in that column fill it with the desired … Read more