Example #1
0
        internal static int udpdateShot(clsShot shot)
        {
            int result = 0;

            SqlCeCommand com = new SqlCeCommand("UPDATE tblBattingShots set Name=@p2 WHERE ID=@p1", connection.CON);

            com.Parameters.AddWithValue("@p1", shot.shotId);
            com.Parameters.AddWithValue("@p2", shot.shotName);
            result = com.ExecuteNonQuery();
            return(result);
        }
Example #2
0
        internal static int addShot(clsShot shot)
        {
            SqlCeCommand com = new SqlCeCommand("INSERT INTO tblBattingShots VALUES(@p1,@p2)", connection.CON);

            com.Parameters.AddWithValue("@p1", shot.shotId);
            com.Parameters.AddWithValue("@p2", shot.shotName);
            try
            {
                return(com.ExecuteNonQuery());
            }
            catch (Exception e)
            {
                clsMessages.showMessage(clsMessages.msgType.error, e.Message);
            }
            return(0);
        }
Example #3
0
        internal static clsShot getShot(int shotId)
        {
            clsShot shot = new clsShot();

            SqlCeCommand     com = new SqlCeCommand("SELECT * FROM tblBattingShots WHERE ID=@p1", connection.CON);
            SqlCeDataAdapter ad  = new SqlCeDataAdapter(com);

            com.Parameters.AddWithValue("@p1", shotId);
            DataSet ds = new DataSet("tblBattingShots");

            ad.Fill(ds, "tblBattingShots");

            DataRow r = ds.Tables["tblBattingShots"].Rows[0];

            shot._shotID   = Convert.ToInt32(r[0].ToString());
            shot._shotName = r[1].ToString();

            return(shot);
        }