Beispiel #1
0
        public static string getData1Field(NpgsqlCommand ocmd)
        {
            string strHasil = "";

            try
            {
                clsConnection xconn = new clsConnection();
                xconn.Open();
                DataTable dt = new DataTable();
                ocmd.Connection  = xconn.Conn;
                ocmd.CommandType = CommandType.Text;
                NpgsqlDataAdapter da = new NpgsqlDataAdapter(ocmd);
                da.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    strHasil = dt.Rows[0].ItemArray.GetValue(0).ToString();
                }
                xconn.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            return(strHasil);
        }
Beispiel #2
0
 public static void xsetupdatedatabase(string strSql)
 {
     try
     {
         clsRegKey oReg = new clsRegKey();
         oReg.RegistryPathCurrentUser = clsGlobal.s_FullRegKey;
         using (clsConnection oConn = new clsConnection())
         {
             oConn.Open();
             NpgsqlCommand ocmd = new NpgsqlCommand();
             ocmd             = new NpgsqlCommand();
             ocmd.Connection  = oConn.Conn;
             ocmd.CommandText = strSql;
             ocmd.ExecuteNonQuery();
             oConn.Close();
         }
     }
     catch (Exception ex)
     {
         //throw
     }
 }