问题描述
您好
我在c#.net中创建了一个商业应用程序,我在服务器中使用
多个用户。虽然所有用户一次创建一次发票,但是花费了更多的时间,有时应用程序没有响应条件。
注意:当一个用户在发票上创建时没有自动增加
使用增加的发票编号保存另一个用户。 />
你能不能建议我如何解决这个问题。
创建发票的代码
Hi
I have created one business application in c#.net and I am using in server containing
multiple users. While creating the invoices by all the users once at a time it has been
taken more time and sometimes application getting not responding condition.
Note: When one user created on invoice no then automatically that will be incremented
saving the other user with incremented invoice no.
would you please suggest me how to overcome this problem.
My Code for creating Invoice
{
string strTran = "";
strTran = cfs.getTRNumber("INV", cpnyid);
ddl_Inv.Text = strTran;
if (txt_Cus_Name.Text == "")
{
MessageBox.Show("Please select Customer.", Properties.Settings.Default.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
txt_Cus_Name.Focus();
return;
}
else if (dataGridViewEx1.Rows.Count < 1)
{
MessageBox.Show("Please add Products to save your order.", Properties.Settings.Default.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
else
{
//20150707dav
if (ddl_Inv.Text.Length < 9)
{
sqlstr = "select INV_NO from " + tablename + " where INV_NO='" + ddl_Inv.Text + "' and Deleted=0 ";
if (cfs.checktrno(sqlstr) == false)
{
strTran = cfs.getTRNumber("INV", cpnyid);
//MessageBox.Show("Invoice: " + ddl_Inv.Text + " already existed in database." +
// "\r\n[Updating Invoice With New " + strTran + " save again]", Properties.Settings.Default.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
ddl_Inv.Text = strTran;
if (Basic.Default.ismulno == false)
{
cmd.CommandText = "update rstockno set RS_INV_NO='" + Properties.Settings.Default.trno.ToString() + "' where ID='" + cpnyid + "'";
cmd.ExecuteNonQuery();
cn.Close();
}
if (CheckForPrice(dataGridViewEx1).Count > 0)
{
string price = "";
foreach (string str in CheckForPrice(dataGridViewEx1))
{
price += str + ",";
}
DialogResult result = MessageBox.Show("Price can not be '0.00'.Do you want to proceed? This will effect the costing", "Warning",
MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (result == DialogResult.No)
{
return;
}
else
{
save();
txt_Quo_ExtRema.Enabled = true;
lsPrice();
lsPrice2();
}
}
//ddl_Inv.Text = "";
}
else
{
save();
lsPrice();
lsPrice2();
//txt_Quo_ExtRema.Enabled = true;
}
}
}
catch { if(!dr.IsClosed==true)dr.Close(); }
Properties.Settings.Default.RowCount = 0;
}
在保存方法中,我写了发票的插入查询
In save method I have written insert query of invoice
推荐答案
这篇关于如何使用sql server避免在Windows应用程序中出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!