Sqlexception was unhandled by user code

Status
Not open for further replies.

muraleecse83

New member
Joined
Jan 25, 2012
Messages
1
Programming Experience
Beginner
But i got it from con.open();


string applicationPath = request.ApplicationPath;
HttpContext context = ((HttpApplication)sender).Context;
string c1 = context.Trace.TraceMode.ToString();

if (applicationPath == "/")
{
applicationPath = string.Empty;

}
string requestPath = request.Url.AbsolutePath.Substring(applicationPath.Length);


string replace = requestPath.Substring(requestPath.Length-5,5);
if (replace == ".aspx")
{
con.Open();
string T = "Insert into tbl_userRequest values('" + U + "','" + requestPath + "','" + Time + "')";
SqlCommand cm = new SqlCommand("Insert into Table1 values('" + c1 + "')", con);
cm.ExecuteNonQuery();
SqlCommand c = new SqlCommand(T, con);
c.ExecuteNonQuery();
con.Close();

}
 
Status
Not open for further replies.
Back
Top