drop table x
create table x(x int, y int)
insert into x values (1,2)
update x set x=y , y=x
select * from x
what happens
Friday, January 30, 2015
Thursday, January 22, 2015
Would you believe...
select 1 where 'Draft' like '%' + 'Dr' + '%'
select 1 where '%' + 'Dr' + '%' like 'Draft'
i guess its obvious that what follows like is a subset
select 1 where '%' + 'Dr' + '%' like 'Draft'
i guess its obvious that what follows like is a subset
Thursday, January 15, 2015
Getting values out of a JSON object in c# when the object is an array
var values = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(strVal);
foreach (var val in values)
{
blah.Add(int.Parse(val.First(x => x.Key.Equals("blahId")).Value.ToString()));
Downloading Files in MVC where excel is not actually opened
I inherited from FileResult and it did not download - even though I set download name
I did this and it works
public FileResult DownloadTextAsAFile(string data, string name)
{
string fileName = string.Format("{0}.csv", name);
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(data);
return new FileContentResult(bytes, "application/vnd.ms-excel") { FileDownloadName = name };
}
I did this and it works
public FileResult DownloadTextAsAFile(string data, string name)
{
string fileName = string.Format("{0}.csv", name);
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(data);
return new FileContentResult(bytes, "application/vnd.ms-excel") { FileDownloadName = name };
}
Wednesday, January 14, 2015
to select a particular forms elements in jquery
just use the form's id as one of the selectors
Force filedownload
response.AppendHeader("content-disposition", "attachment; filename=" + FileDownloadName);
Add an action to a form with jquery
$("#blah").get(0).setAttribute('action', blahURL);
Subscribe to:
Posts (Atom)