Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot open connection if the server is not local
    primarykey
    data
    text
    <p>I have this code in Transaction.cs</p> <pre><code>using (TransactionScope scope = new TransactionScope()) { // Setup nhibernate configuration Configuration config = new Configuration(); config.SetProperty("hibernate.connection.connection_string", GlobalVar.TRUECONNSTRING); config.SetProperty("hibernate.command_timeout", "3600"); config.AddAssembly(typeof(ProductionMovein).Assembly); // Setup nhibernate session ISessionFactory factory = config.BuildSessionFactory(); ISession session = factory.OpenSession(); ITransaction transaction = session.BeginTransaction(); //Recalculate Number PairData pairCabang = (PairData)comboCabang.SelectedItem; textNo.Text = FormFunction.getNumber(2, pairCabang.key, dtpTanggal.Value); // Insert data try { //ProductionMoveIn ProductionMovein productionMoveIn = new ProductionMovein(); productionMoveIn.Nomor = textNo.Text; session.Save(productionMoveIn); transaction.Commit(); session.Close(); } catch (Exception ex) { transaction.Rollback(); session.Close(); MessageBox.Show(ex.InnerException.Message); return 1; } scope.Complete(); } </code></pre> <p>And the error is started from </p> <blockquote> <p>textNo.Text = FormFunction.getNumber(2, pairCabang.key, dtpTanggal.Value);</p> </blockquote> <p>i have this code in Formfunction.cs</p> <pre><code>public static string getNumber(int formID, int cabangID, DateTime date) { string formNumber = ""; string strQuery = ""; formNumber += formNames[formID, 0] + "/" + + date.ToString("yy") + date.ToString("MM") + "/"; // Setup nhibernate configuration NHibernate.Cfg.Configuration config = new NHibernate.Cfg.Configuration(); config.SetProperty("hibernate.connection.connection_string", GlobalVar.TRUECONNSTRING); config.SetProperty("hibernate.command_timeout", "3600"); config.AddAssembly(typeof(Login).Assembly); //// Setup nhibernate session ISessionFactory factory = config.BuildSessionFactory(); ISession session = factory.OpenSession(); strQuery = "SELECT MAX(REVERSE(SUBSTRING(REVERSE(a.Nomor), 1, 5))) as 'latest' FROM " + formNames[formID, 1] + " a WHERE a.cabang = " + cabangID + " AND YEAR(a.tanggal) = '" + date.ToString("yyyy"); Object result = session.CreateSQLQuery(strQuery) .AddScalar("latest", NHibernateUtil.Int32) .UniqueResult(); session.Close(); int nRow; if (result == null) nRow = 0; else nRow = (int)result; formNumber += (nRow + 1).ToString("d5"); return formNumber; } </code></pre> <p>I have tried to change the Server to 10.10.7.10 (my ip) and it works. but, when i change to other ip, it cannot open connection. I have tried to turn on msdtc on my computer and the other server i tried to connect, but still get the same error. <img src="https://i.stack.imgur.com/F7aHB.jpg" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/Bl1YS.jpg" alt="enter image description here"></p> <p>Can anybody help me how to solve this error?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload