Example #1
0
 public DsMaster.PROFILENAMEMASTDataTable LoadProfileNames()
 {
     var ta = new DsMasterTableAdapters.PROFILENAMEMASTTableAdapter {Connection = {ConnectionString = _constr}};
     var ds = new DsMaster.PROFILENAMEMASTDataTable();
     ta.Fill(ds);
     return ds;
 }
Example #2
0
 public string DoSave(string pname)
 {
     string retval;
     try
     {
         var cn = new SqlConnection {ConnectionString = _constr};
         cn.Open();
         var dt = new DsMaster().PROFILENAMEMAST;
         bool isnew = false;
         var ta = new DsMasterTableAdapters.PROFILENAMEMASTTableAdapter {Connection = cn};
         ta.Fill(dt);
         var dr = dt.FindByPROFILENAME(pname);
         if (dr != null)
         {
             dr.BeginEdit();
         }
         else
         {
             dr = (DsMaster.PROFILENAMEMASTRow) dt.NewRow();
             isnew = true;
         }
         dr.PROFILENAME = pname;
         if (isnew)
         {
             dt.Rows.Add(dr);
             ta.Update(dt);
         }
         else
         {
             dr.EndEdit();
             ta.Update(dt);
         }
         retval = "1";
     }
     catch (Exception ex)
     {
         retval = ex.ToString();
     }
     return retval;
 }