Simple download from GridView? Well, no – it should be – try this

So the code in theory is super slick – just use a StringWriter and HtmlWriter and in 2-5 commands it is downloaded to the client (see this link and the caveats that people use to get things working!). NO SUCH LUCK HERE. The main reason is that I have 2 columns with buttons in them at the front – the whole grid is DYNAMICALLY created by myself in the code (that is not included below). The c# code is included below.

So using some other researching I found a couple of concepts that worked together. I am sure there are some other optimizations but this worked.

First, I converted the GridView contents to a DataTable and for all columns 3 or more columns over I filled the datatable. Thanks to this fellow. Because the Gridview has all the source info including column headers etc. it works out great. Continue reading

Kids Literacy Links – Family Games night

Tonight we went to a literacy games night at the Deer Run Elementary School. From this, they had a page with links for websites and iOS apps. Rather than lose them, here they are!

Websites

Apps

Mixing different versions of .net – 4.5 (CLR4) app referencing 3.5 dlls (CLR2)

Some articles as i collect them are:

ASPX ordered lists with HTML – why does it need to be so hard? Here are some links

Putting HTML in bulleted lists seems quite straightforward until you try it. The items only accept text and html is rendered as text so you don’t get the html – you SEE the html. OK – so some digging turned up the following useful links. These are good for the same items but I need dynamic html different in one item than the other so I am doing it with html and a div or something.

These links will no doubt prove useful for repeating items that are the same.

I got a link from ZOHO telling me they wanted me to remove my links to them – No – this is the WWW – note the 3rd W

Google had informed them “recently received a notification from Google stating that our website has unnatural links pointing towards [zoho]. This has really damaged our Keyword rankings on Google …” and to remove the links. It was my recent article on a topic about them and some links to them that solved – what should be quite simple but it is QUITE HARD actually and I had been victorious.

Here is an article to help with a redirect that made me clear up Google crawling errors.

What? No – I am not going to remove any links! This is a website is all about STORING LINKS for myself and others reading this. Continue reading

mySQL Tables growing to 7 million rows cannot be optimized – here is another way

Optimizing these large tables DOES NOT WORK. It corrupts them and you have to talk to tech support to get backups restored. Even when you ssh into the server and do it “command line.” I reminded myself of this yesterday when I optimized a table forgetting the better way.

First, back up the sluggish table. It had lots of overhead – this is a hint. Another way to back it up, is to copy it to a new table. Here’s how (don’t do this from phpmyadmin because it will for sure time out). I use a mac so I have sequel_pro AND SET THE TIMEOUT  TO 1000 seconds or more in the preferences. If you have access to ssh into the machine – even better.

[sql]</pre>
CREATE TABLE xxx_backupddd_nnn LIKE xxx;
insert into xxx_backupddd_nnn SELECT * FROM xxx;

RENAME TABLE xxx TO xxx_overheadddd_nnn;
CREATE TABLE xxx LIKE xxx_overheadddd_nnn;
INSERT into xxx SELECT * FROM xxx_backupddd_nnn;
<pre>

[/sql]

In my case xxx is the table and ddd_nnn the date and attempt such as 20140303_1.  I run each command line by line and carefully look at the output. Sometimes the server times out even after 1/2 seconds so be watchful.

No tech support phone call or $15 backup recovery fee required. Really – that is not bad for a recovery fee.

SQL Server access MS 2010 Access database with password. Finally

So I have had LOTS of attempts to get into a password protected MS 2010 Access database and most people online say it cannot be done (the advice in many google’ed articles) , however one guy gave me the hint to get this solved for me in “Answer 4”.

Scenario:

  1. I am connected to SSMS on domain #1 called F which is a SQL Server on Domain D
  2. MS Access file is on Domain D on the c drive c:\Temp\dB123.accdb (this c: drive is the one where the SQL Server is running)
  3. In SSMS, I made a new Linked Server using the GUI Continue reading

ZipFiles – not that hard, but here are some links to get through what should be super simple

I need to zip files and add a timestamp to the zip filename, or I don’t have a backup system (I just have a copy of the latest files whether or not they are correct). This is TOTALLY related to my article on scripting out my SQL table data contents. This is run as a scheduled task – but I had to take a copy of the solution on my LOCAL drive- not a network copy or else the scheduled tasks does not work. See my article to reduce frustrations on Scheduled Tasks.

Using c# – here is the code snibbet (read the whole article though) Continue reading

SMO for SQL Backup … of sorts

[Latest Edit Feb 14th] So, I go to edit a few Stored Procs on my MSSQL database and… errors – table missing – what? I seems over the weekend, all the databases were reset to some time in the past – this means 30 SP’s and 20 tables on our dev environment have – poof vanished – an honest mistake due to a communication misunderstanding. Not a big deal – everything is version controlled. It was the testing data that was lost and that people are semi-using at the moment that really gets my goat and makes me want to pull my hair out. I had a set of data that was perfect for making the next module.

So I searched for backup routines and since I use c# and think the SMO addition is so cool, I found some more great links – and the code worked in < 10 minutes each. Continue reading