Friday, December 21, 2012
Get List Of Processes Using A DLL
Appending case to varchar in select
make sure you have an "else";otherwise you will append in some cases a null which will blot out the select
Thursday, December 20, 2012
Datatable Merge
if the schema is the same it will work as a union , if it has a different schema then that depends on
for e.g.
for e.g.
DataTable
t1 = new DataTable();
t1.Columns.Add("key1");
t1.Columns.Add("c1");
t1.PrimaryKey = new[] { t1.Columns["key1"]
};
t1.Rows.Add(1, "data1");
DataTable
t2 = new DataTable();
t2.Columns.Add("key1");
t2.Columns.Add("c2");
t2.PrimaryKey = new[] { t2.Columns["key1"]
};
t2.Rows.Add(1, "data2");
t1.Merge(t2, false, MissingSchemaAction.Add);
t1.Merge(t2);
will produce
while
DataTable
t3 = t1.Clone();
t3.Rows.Add("key2", "datablah",
"datablah2");
t1.Merge(t3);
will produce
Array of Bytes to File
easy method
using (System.IO.FileStream _FileStream = new System.IO.FileStream(@"C:\blah\blah.csv", System.IO.FileMode.Create, System.IO.FileAccess.Write))
{
_FileStream.Write(bytesarray, 0, bytesarray.Length);
_FileStream.Close();
}
Wednesday, December 19, 2012
The maximum array length quota (NNNN) has been exceeded
add readerquotas to binding
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxNameTableCharCount="2147483647" />
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxNameTableCharCount="2147483647" />
Tuesday, December 11, 2012
Service reference not being registered by vs
Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'.
sp_executeSQL , for example , accepts only a parameter of nvarchar
Monday, December 10, 2012
to avoid The site's security certificate is not trusted! errors
use this in Global aspx
void
Application_Start(object sender, EventArgs e)
{
// Code
that runs on application startup
System.Net.ServicePointManager.ServerCertificateValidationCallback
=
((certSender, certificate,
chain, sslPolicyErrors) => true);
}
of course , this is where there is no security issue
Would you like to make Internet Explorer your default browser?
Wednesday, December 5, 2012
Limiting file size of uploads in IIS
maxRequestLength indicates the maximum request size supported by ASP.NET
measured in KB
<httpRuntime executionTimeout="900" maxRequestLength="1048576"/>
maxAllowedContentLength specifies the maximum length of content in a request supported by IIS.
measured in bytes
<requestFiltering>
<requestLimits maxAllowedContentLength="1048576000" />
measured in KB
<httpRuntime executionTimeout="900" maxRequestLength="1048576"/>
maxAllowedContentLength specifies the maximum length of content in a request supported by IIS.
measured in bytes
<requestFiltering>
<requestLimits maxAllowedContentLength="1048576000" />
Tuesday, December 4, 2012
Excel-CSV Date Issues
What happens when you save the following s/sh to csv?
The first column is formatted mm-dd-yyyy (jan-2 ), the second dd-mm-yyyy(feb-12 )
The answer: 12-02-2011,12-02-2011
Linq issues with datatables
first the interesting thing
if a linq query returns an empty array of datarows - you can still run tolist() on the object.
a different issue that sidetracked me for a long time - if you do something like
if a linq query returns an empty array of datarows - you can still run tolist() on the object.
a different issue that sidetracked me for a long time - if you do something like
row.Field<string>("BLAH").ToLower()
this will fail if null
Subscribe to:
Posts (Atom)