Just put COLLATE Latin1_General_CS_AS allong with WHERE condition
ex:
SELECT * from tbl_User
WHERE State COLLATE Latin1_General_CS_AS = 'nc'
Monday, September 7, 2009
Wednesday, August 26, 2009
calling webservice from javascript with parameters
below is a simple javascript to tell you how to call web service with parameter
It will give you state and City for a zipcode you given
please assume there is 3 text boxes txtZip, txtState and txtCity
<script type="text/javascript">
var WebReq = null;
function findZip() {
//create dom
if (window.XMLHttpRequest)
WebReq = new XMLHttpRequest();
else if (window.ActiveXObject) {
if (new ActiveXObject("Microsoft.XMLHTTP"))
WebReq = new ActiveXObject("Microsoft.XMLHTTP");
else
WebReq = new ActiveXObject("Msxml2.XMLHTTP");
}
//url of webservice. see last, which is the name of our method to call
var url = "http://localhost:2508/MyProject/MyWebService/Service1.asmx/getCityState";
WebReq.open("post", url, true);
WebReq.setRequestHeader("Host",http://myproject/);
WebReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
WebReq.setRequestHeader("Content-Length","100");
//now mention method name (here is Result, check below i declared the method Result() ), ie after sending request , it will call this method to execute web response
WebReq.onreadystatechange = Result;
//taking zipcode from txtZipCode
var vZipCode = document.getElementById('');
//Adding Parameter ZipCode
WebReq.send("ZipCode=" + vZipCode.value);
}
function Result()
{
if (WebReq.readyState == 4 && WebReq.status == 200)
{
var dsRoot=WebReq.responseXML;
var City = dsRoot.getElementsByTagName('City')[0].firstChild.nodeValue;
var State = dsRoot.getElementsByTagName('State')[0].firstChild.nodeValue;
//Setting New value to city and State
var vCity = document.getElementById('');
var vState = document.getElementById('');
vCity.value = City;
vState.value= State;
}
}
It will give you state and City for a zipcode you given
please assume there is 3 text boxes txtZip, txtState and txtCity
<script type="text/javascript">
var WebReq = null;
function findZip() {
//create dom
if (window.XMLHttpRequest)
WebReq = new XMLHttpRequest();
else if (window.ActiveXObject) {
if (new ActiveXObject("Microsoft.XMLHTTP"))
WebReq = new ActiveXObject("Microsoft.XMLHTTP");
else
WebReq = new ActiveXObject("Msxml2.XMLHTTP");
}
//url of webservice. see last, which is the name of our method to call
var url = "http://localhost:2508/MyProject/MyWebService/Service1.asmx/getCityState";
WebReq.open("post", url, true);
WebReq.setRequestHeader("Host",http://myproject/);
WebReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
WebReq.setRequestHeader("Content-Length","100");
//now mention method name (here is Result, check below i declared the method Result() ), ie after sending request , it will call this method to execute web response
WebReq.onreadystatechange = Result;
//taking zipcode from txtZipCode
var vZipCode = document.getElementById('');
//Adding Parameter ZipCode
WebReq.send("ZipCode=" + vZipCode.value);
}
function Result()
{
if (WebReq.readyState == 4 && WebReq.status == 200)
{
var dsRoot=WebReq.responseXML;
var City = dsRoot.getElementsByTagName('City')[0].firstChild.nodeValue;
var State = dsRoot.getElementsByTagName('State')[0].firstChild.nodeValue;
//Setting New value to city and State
var vCity = document.getElementById('');
var vState = document.getElementById('');
vCity.value = City;
vState.value= State;
}
}
Thursday, August 20, 2009
InnerText problem in firefox
its tue that innerText property does not support firefox, but it will work in IE. This is one of the issues facing on web developers. Here is my solution
below example will store 100 in label lblPremAmt.
firefox support textContent property which is equivalent to innerText in IE.
var vlblPremAmt = document.getElementById("<%= lblPremAmt.ClientID %>");
if(document.all)
{
vlblPremAmt.innerText = 100;
}
else
{
vlblPremAmt.textContent = 100;
}
below example will store 100 in label lblPremAmt.
firefox support textContent property which is equivalent to innerText in IE.
var vlblPremAmt = document.getElementById("<%= lblPremAmt.ClientID %>");
if(document.all)
{
vlblPremAmt.innerText = 100;
}
else
{
vlblPremAmt.textContent = 100;
}
Monday, August 3, 2009
call and execute a method using HttpWebRequest
Here is test code will call and execute a method in some server and retrive xml output.
string Qstring = "name=Alex&age=20";
string url = "https://mywebserver.com/websites.exe";
string data = Qstring; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = WebRequestMethods.Http.Post;
request.ContentLength = data.Length;
request.ContentType = "application/x-www-form-urlencoded";
StreamWriter writer = new StreamWriter(request.GetRequestStream());
writer.Write(data);
writer.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
strMVRXML = reader.ReadToEnd(); response.Close();
System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument();
xDoc.LoadXml(strXML);
string Qstring = "name=Alex&age=20";
string url = "https://mywebserver.com/websites.exe";
string data = Qstring; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = WebRequestMethods.Http.Post;
request.ContentLength = data.Length;
request.ContentType = "application/x-www-form-urlencoded";
StreamWriter writer = new StreamWriter(request.GetRequestStream());
writer.Write(data);
writer.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
strMVRXML = reader.ReadToEnd(); response.Close();
System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument();
xDoc.LoadXml(strXML);
Tuesday, May 12, 2009
how to get error message from error no in SQL server
SELECT * FROM master.dbo.sysmessages
WHERE error = 8115 AND msglangid = 1033
WHERE error = 8115 AND msglangid = 1033
Tuesday, March 24, 2009
Asp.net Querystring Encrypt
ur query string in url address will be encrypted but u can access querystring using
Request.QueryString["<QueryStringName>"].
no need to add any xtra code, just follow below 2 steps
1. Download .cs file from http://blog.madskristensen.dk/post/HttpModule-for-query-string-encryption.aspx
Request.QueryString["<QueryStringName>"].
no need to add any xtra code, just follow below 2 steps
1. Download .cs file from http://blog.madskristensen.dk/post/HttpModule-for-query-string-encryption.aspx
2. modify web config file
<httpModules>
<add type="QueryStringModule" name="QueryStringModule" />
</httpModules>
Friday, March 20, 2009
Delete Key Fro registry
RegistryKey key = Registry.CurrentUser;
key.DeleteSubKey("Software\\Rosh");
//Removing From startup
Registry.LocalMachine.OpenSubKey ("SOFTWARE\ Microsoft\Windows\ CurrentVersion\ Run", True).DeleteValue(Application.ProductName)
key.DeleteSubKey("Software\\Rosh");
//Removing From startup
Registry.LocalMachine.OpenSubKey ("SOFTWARE\ Microsoft\Windows\ CurrentVersion\ Run", True).DeleteValue(Application.ProductName)
Subscribe to:
Posts (Atom)