Most of the time we grab the date and time using sql server GetDate() Function.
Sometimes if data is filtered between two dates it may give erroneous result. Why? Because while retrieving data using date as filter criteria, it will fetch records which are nearest 3 milliseconds.
It will be more clear by following example.
Create Table datetesting
(
PK_id INT IDENTITY,
Datefield DateTime
)
Insert into datetesting(DateField)
Values (’1/2/09 00:00′)
Insert into datetesting(DateField)
Values (’1/2/09 23:59′)
Insert into datetesting(DateField)
Values (’1/2/09 11:59:59.995 pm’)
Insert into datetesting(DateField)
Values (’1/3/09′)
Now Execute the following query
Select * from datetesting where Datefield Between ’1/2/9′ AND ’1/2/9 11:59:59.998 PM’
Result of the above query
PK_id DateField
—————————————
1 2009-01-02 00:00:00.000
2 2009-01-02 23:59:00.000
3 2009-01-02 23:59:59.997
Now, Try the following query to retrieve data. I have just added 1 millisecond and it will retrieve date 2009-01-03 00:00:00.000 which does not match the criteria.
Select * from datetesting where Datefield Between ’1/2/9′ AND ’1/2/9 11:59:59.999 PM’
PK_id DateField
—————————————
1 2009-01-02 00:00:00.000
2 2009-01-02 23:59:00.000
3 2009-01-02 23:59:59.997
4 2009-01-03 00:00:00.000
So next time when you face wrong data by filter, don’t get perplexed, This may be the reason!
In this post, we will see how we can implement salesforce login with flex.
All you need is:
For the beginner steps for integration of flex toolkit for salesforce you can follow the steps given in below site
http://wiki.developerforce.com/index.php/Tutorial:_Creating_Flex_Salesforce_Mashups
While regarding the login method I will be describing as follows:
The namespaces to be included in flex builder for login are as follows:

namespace for flex to salesforce
The Login function will be as follows:

Login method for flex to salesforce
There is a common error while implementing login with salesforce, it will generate following error:
(com.salesforce.events::ApexFaultEvent)#0
bubbles = false
cancelable = true
context = (null)
currentTarget = (null)
eventPhase = 2
fault = (mx.rpc::Fault)#1
errorID = 0
faultCode = “Server.Error.Request”
faultDetail = “Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://www.salesforce.com/services/Soap/u/11.0"]. URL: http://www.salesforce.com/services/Soap/u/11.0″
faultString = “HTTP request error”
message = “faultCode:Server.Error.Request faultString:’HTTP request error’ faultDetail:’Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://www.salesforce.com/services/Soap/u/11.0"]. URL: http://www.salesforce.com/services/Soap/u/11.0′”
name = “Error”
rootCause = (flash.events::IOErrorEvent)#2
bubbles = false
cancelable = false
currentTarget = (flash.net::URLLoader)#3
bytesLoaded = 0
bytesTotal = 0
data = (null)
dataFormat = “text”
eventPhase = 2
target = (flash.net::URLLoader)#3
text = “Error #2032: Stream Error. URL: http://www.salesforce.com/services/Soap/u/11.0″
type = “ioError”
message = (mx.messaging.messages::ErrorMessage)#4
body = (Object)#5
clientId = “DirectHTTPChannel0″
correlationId = “026E48D3-1BFD-8AA6-A5D6-CDE8A1C8B7D8″
destination = “”
extendedData = (null)
faultCode = “Server.Error.Request”
faultDetail = “Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://www.salesforce.com/services/Soap/u/11.0"]. URL: http://www.salesforce.com/services/Soap/u/11.0″
faultString = “HTTP request error”
headers = (Object)#6
messageId = “154CD995-435D-2011-47FB-CDE8A2A25895″
rootCause = (flash.events::IOErrorEvent)#2
timestamp = 0
timeToLive = 0
messageId = “154CD995-435D-2011-47FB-CDE8A2A25895″
target = (null)
token = (mx.rpc::AsyncToken)#7
message = (mx.messaging.messages::HTTPRequestMessage)#8
body = “<se:Envelope xmlns:se=”http://schemas.xmlsoap.org/soap/envelope/”><se:Header xmlns:sfns=”urnartner.soap.sforce.com”/><se:Body><login xmlns=”urnartner.soap.sforce.com” xmlns:ns1=”sobject.partner.soap.sforce.com”><username>[email protected]</username>
<password>xxxxxxxxxxxxx9KYz1Hmt965XXXXQcNVpjaq61</password></login></se:Body></se:Envelope>”
clientId = (null)
contentType = “text/xml; charset=UTF-8″
destination = “DefaultHTTP”
headers = (Object)#9
DSEndpoint = “direct_http_channel”
httpHeaders = (Object)#10
Accept = “text/xml”
SOAPAction = “”"”
X-Salesforce-No-500-SC = “true”
messageId = “026E48D3-1BFD-8AA6-A5D6-CDE8A1C8B7D8″
method = “POST”
recordHeaders = false
timestamp = 0
timeToLive = 0
url = “http://www.salesforce.com/services/Soap/u/11.0″
responders = (Array)#11
[0] (::SalesForceResponder)#12
result = (null)
type = “fault”
Solution
The Flex security model will require that you are running this on https server, unless you specify “http” using connection.protocol();
If your server is not HTTPS, but is HTTP, you can set that on the connection.
In addition, you will need to pass a security token appended to your password unless you have enabled the IP range in your network configuration.
Both will generate the io error you see.
If you are using “HTTPS” then you have to specify
connectionprotocol = “https”
And make sure that in salesforce.com by default “Require secure connections (https)” is checked

Sales force security setting
But if you are using “http”, then you have to specify
connectionprotocol = “http”;
And make sure that in salesforce.com by default “Require secure connections (https)” is checked to false.

salesforce https setting