log table data was not inserting?
<p>I am creating log files, for that I used this code, log file is getting created, but I want log table also same like as logfile. I have created a table on database and I am passing the values manually but logtable was not filling plz check?</p>

<pre><code>public partial class dataForm : Form
    {
        string name;
        string operation;
        DateTime dtdate;

        SqlConnection con = new SqlConnection(@"Data Source=CENSYS07\SQLEXPRESS;Initial Catalog=Sample;Integrated Security=true");
        SqlCommand cmd;       

        public dataForm()
        {
            InitializeComponent();
        }

        private void BtnInsert_Click(object sender, EventArgs e)
        {
            try
            {
                name = txtName.Text;
                operation = "inserted";
                dtdate = DateTime.Now;
                cmd = new SqlCommand("insert into InsLog(name,operations,date)values('" + txtName.Text + "','inserted', " + dtdate + ")", con);
                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();

                cmd = new SqlCommand("sp1", con);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter[] p1 = new SqlParameter[4];

                p1[0] = new SqlParameter("@name", txtName.Text);
                p1[1] = new SqlParameter("@address", TxtAddress.Text);
                p1[2] = new SqlParameter("@city", txtCity.Text);
                p1[3] = new SqlParameter("@insup", 1);
                con.Open();
                cmd.Parameters.AddRange(p1);
                cmd.ExecuteNonQuery();
                con.Close();
            }
            catch (Exception ex)
            {
            }

            {
                if (!Directory.Exists("C://LOGINFO")) 
                {
                    Directory.CreateDirectory("C://LOGINFO");
                }
                string strDir = "C://LOGINFO//inslog.hhh";

                //string strDir = Application.StartupPath.Replace("bin\\Debug", "\\logfiles\\loginfo.txt");

               // Directory.CreateDirectory(@"\\200.100.0.50\chandu\abc.txt");
                if (!File.Exists(strDir))
                {   
                    File.Create(strDir);
                }

                string filePath = strDir;

                using (StreamWriter swrObj = new StreamWriter(filePath, true))
                {
                    swrObj.Write(txtName.Text + " inserted on" + DateTime.Now.ToLongDateString() + " at " + DateTime.Now.ToLongTimeString());

                    swrObj.Write("\t\t");
                    swrObj.Write("\t\t");

                    swrObj.WriteLine();
                    swrObj.Close();

                    MessageBox.Show("record inserted");
                }
</code></pre>

<p>( "Incorrect syntax near '4'.") this is the error i am getting?</p>
