While loading data in grid in production server I found following script Error on Page left bottom corner (This error is occurring only on production server, in local server its working fine) This error is occurring inconsistently
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; BTRS123646; Embedded Web Browser from: http://bsalsa.com/; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E) Timestamp: Tue, 9 Oct 2012 12:11:23 UTC
Message: Unterminated string constant Line: 111115201 Char: 187 Code: 0
URI: XYXZ/MYApp/MyPage.aspx
following is the code for binding data in grid
try
{
conGetPost.ConnectionString = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString;
conGetPost.Open();
SqlCommand cmdGetPost = new SqlCommand();
cmdGetPost.CommandTimeout = 999999999;
cmdGetPost.Connection = conGetPost;
cmdGetPost.CommandType = CommandType.StoredProcedure;
cmdGetPost.CommandText = "MySP";
if (wdpfrom.Value.ToString() == "1/1/0001 12:00:00 AM" || wdpTo.Value.ToString() == "1/1/0001 12:00:00 AM")
{
ShowMessage("Please select proper Date range");
wdgPost.DataSource = "";
wdgPost.DataBind();
return;
}
else
{
cmdGetPost.Parameters.AddWithValue("@dateFrom", wdpfrom.Value);
cmdGetPost.Parameters.AddWithValue("@dateTo", Convert.ToDateTime(wdpTo.Value.ToString()).Add(new TimeSpan(23, 59, 59)));
}
cmdGetPost.Parameters.AddWithValue("@ID", ID);
SqlDataAdapter daGetPost = new SqlDataAdapter();
daGetPost.SelectCommand = cmdGetPost;
daGetPost.Fill(dsGetPost);
if (dsGetPost.Tables.Count > 0)
{
if (dsGetPost.Tables[0].Rows.Count > 750)
{
ShowMessage("Maximum record found please reduce date range");
wdgPost.DataSource = "";
wdgPost.DataBind();
return;
}
}
wdgPost.ClearDataSource();
wdgPost.DataSource = dsGetPost;
wdgPost.DataBind();
if (dsGetPost.Tables[0].Rows.Count == 0)
{
ShowMessage("No records found");
}
Session["dsGetPost"] = dsGetPost;
}
catch( Exception ex)
{
return;
}
finally
{
if (conGetPost != null)
{
conGetPost.Close();
conGetPost = null;
}
}
How to know the line no in my C# code? How to fix it? Please Help