Ejemplo n.º 1
0
        public void AddLogEntry(LogEntry entry)
        {
            ConnectionStringSettings constr = ConfigurationManager.ConnectionStrings["mssql"];
            SqlConnection db = new SqlConnection();
            //constr.DataSource = "DAIMONX";
            //constr.InitialCatalog = "MSMONGO";
            //constr.UserID = "sa";
            //constr.Password = "******";
            //constr.IntegratedSecurity=true;
            db.ConnectionString = constr.ToString();

            SqlCommand myCommand = new SqlCommand();
            myCommand.Parameters.Add("@mdate", System.Data.SqlDbType.DateTime).Value = entry.Date;
            myCommand.Parameters.Add("@msg", System.Data.SqlDbType.VarChar).Value = entry.Message;
            myCommand.CommandText = "INSERT INTO ENTRIES (mdate, message) VALUES(@mdate, @msg)";
            myCommand.Connection = db;

            db.Open();
            myCommand.ExecuteNonQuery();
            db.Close();
        }
Ejemplo n.º 2
0
        public void AddLogEntry(LogEntry entry)
        {
            string myInsertQuery = "INSERT INTO entries (mdate, message) Values(@mdate, @msg)";

            MySqlParameter mdate = new MySqlParameter();
            mdate.MySqlDbType = MySqlDbType.DateTime;
            mdate.ParameterName = "@mdate";
            mdate.Value = entry.Date;

            MySqlParameter msg = new MySqlParameter();
            msg.MySqlDbType = MySqlDbType.VarChar;
            msg.ParameterName = "@msg";
            msg.Value = entry.Message;

            MySqlCommand myCommand = new MySqlCommand(myInsertQuery, db);
            myCommand.Parameters.Add(mdate);
            myCommand.Parameters.Add(msg);

               myCommand.Connection.Open();
               myCommand.ExecuteNonQuery();
               myCommand.Connection.Close();
        }
Ejemplo n.º 3
0
 public void AddLogEntry(LogEntry entry)
 {
     Document entryDOC = json.DocumentFrom(entry);
     logs.Insert(entryDOC);
 }