Monday, February 11, 2019

Upload Android App to App Stotre

1. Build Sign APK



2. Create sign



3.Choose release or Debug


4. Finish

Monday, October 16, 2017

ASP.Net MVC Code for MySQL Server


Read data from database

Code

 public ActionResult Index()
        {
            List<CustomerModel> customers = new List<CustomerModel>();
            string connstr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
            using (MySqlConnection con = new MySqlConnection(connstr))
            {
                string query = "SELECT id,fullname, username FROM tbUser";
                using (MySqlCommand cmd = new MySqlCommand(query))
                {
                    cmd.Connection = con;
                    con.Open();
                    using (MySqlDataReader sdr = cmd.ExecuteReader())
                    {
                        while (sdr.Read())
                        {
                            customers.Add(new CustomerModel
                            {
                                id = Convert.ToInt32(sdr["id"]),
                                fullname = sdr["fullname"].ToString(),
                                username = sdr["username"].ToString()
                            });
                        }
                    }
                    con.Close();
                }
            }

            return View(customers);
        }

Picture



Example 2

 public ActionResult Index()
        {
            List<Customer> customers = new List<Customer>();
            string connstr = ConfigurationManager.ConnectionStrings["conndbstr"].ConnectionString;
            using (SqlConnection con = new SqlConnection(connstr))
            {
                string query = "SELECT CusID,FullName,NickName,Company,Phone,Fax,Mobile,Email,Address,TaxReg,Branch,Remark,Status FROM Customer";
                using (SqlCommand cmd = new SqlCommand(query))
                {
                    cmd.Connection = con;
                    con.Open();
                    using (SqlDataReader sdr = cmd.ExecuteReader())
                    {
                        while (sdr.Read())
                        {
                            customers.Add(new Customer
                            {
                                CusID = sdr["CusID"].ToString(),
                                FullName = sdr["FullName"].ToString(),
                                NickName = sdr["NickName"].ToString(),
                                Company = sdr["Company"].ToString(),
                                Phone = sdr["Phone"].ToString(),
                                Fax = sdr["Fax"].ToString(),
                                Mobile = sdr["Mobile"].ToString(),
                                Email = sdr["Email"].ToString(),
                                Address = sdr["Address"].ToString()
                            });
                        }
                    }
                    con.Close();
                }
            }

            return View(customers);
        }

Picture





Insert to database

Code

 public ActionResult Create(CustomerModel users)
        {
            //List<CustomerModel> users = new List<CustomerModel>();
            string connstr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
            using (MySqlConnection con = new MySqlConnection(connstr))
            {
                string query = "INSERT INTO tbUser(fullname,username,password,Role) VALUES(@fullname,@username,@password,@Role)";
                using (MySqlCommand cmd = new MySqlCommand(query))
                {
                    bool status = false;
                    if (ModelState.IsValid)
                    {
                        cmd.Connection = con;
                        con.Open();
                        cmd.Parameters.AddWithValue("@fullname", users.fullname);
                        cmd.Parameters.AddWithValue("@username", users.username);
                        cmd.Parameters.AddWithValue("@password", EncryptString.Encrypt.EncryptText(users.password));
                        cmd.Parameters.AddWithValue("@Role", users.Role);
                        users.id = Convert.ToInt32(cmd.ExecuteNonQuery());
                        con.Close();
                        status = true;
                    }
                }
            }
            return View(users);
        }

Picture



Delete from database

Code
 public ActionResult DeleteConfirmed(string id)
        {
            List<CustomerModel> users = new List<CustomerModel>();
            string connstr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
            using (MySqlConnection con = new MySqlConnection(connstr))
            {
                using (MySqlCommand cmd = new MySqlCommand("DELETE FROM tbUser WHERE id = @id"))
                {
                    using (MySqlDataAdapter sda = new MySqlDataAdapter())
                    {
                        bool status = false;
                        cmd.Parameters.AddWithValue("@id", id);
                        cmd.Connection = con;
                        con.Open();
                        cmd.ExecuteNonQuery();
                        con.Close();
                        status = true;
                    }
                }
            }
                //tbInvoice tbInvoice = db.tbInvoice.Find(id);
                //db.tbInvoice.Remove(tbInvoice);
                //db.SaveChanges();
                return RedirectToAction("Index");
        }

Picture



Wednesday, May 10, 2017


Exit button and message box

 Private Sub btExit_Click(sender As Object, e As EventArgs) Handles pbExit.Click
        If MsgBox("Do you want to quit?", MsgBoxStyle.YesNo Or MsgBoxStyle.DefaultButton2 Or MsgBoxStyle.Question, "Close application") = Windows.Forms.DialogResult.Yes Then
            Application.Exit()
        End If
    End Sub









Friday, February 3, 2017

Crystal Report Cannot Load in VS2013

Crystal Report Error Message

'Could not load file or assembly 'file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.'



How to Fix it:

Add this to your App.config file:

<startup useLegacyV2RuntimeActivationPolicy="true" >









Wednesday, September 7, 2016

Thursday, August 4, 2016

Windows 10 cannot click start menu - FIX DIY


Windows 10 cannot click start menu - FIX DIY

1. Run command prompt (Admin) click YES



2. Type "powershell" Press Enter



3. Copy code as below and paste to PS C:\WINDOWS\system32>

Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\appxmanifest.xml"}

Press Enter....



4. Wait for minute and try again or restart if possible. Enjoy to do by yourself.. 

Scan window system by command prompt - Fix corrupted files

Fix corrupted files


1. Open Windows PowerShell (Admin)   Press Yes........


2. C:\windows\system32>



3. C:\windows\system32>sfc /scannow    Press Enter....


4. Wait for a minute and if possible restart your computer . Enjoy by yourself.......