问题描述
我有一个在IIS 7上发布的ASP.Net应用程序.在我的应用程序中,我已基于之前进行的数据库事务处理计算了JobID.
此计算部分未反映在我的aspx文本框(txt_jobid)上.示例代码如下.请检查一下.
我没有收到任何错误或其他信息. Textbox(txt_jobid)值未正确分配.即使在数据库中,我也发现我的记录已保存.
它在Development Machine中完美运行.但不适用于SERVER MACHINE.
数据库连接是完美的.但它不起作用.
请帮帮我...
问题出在此函数内部.它在我的开发机上正常工作
I have an ASP.Net application that publish on IIS 7. In my application i have calculated an JobID based on database Transaction made before.
This Calculation Part not reflect on my aspx Textbox(txt_jobid). Sample code is below. Please Check it out.
I''m not getting any error or something. Textbox(txt_jobid) value not assign Properly. Even in database i found my records are saved.
Its working perfectly in Development Machine. But not works on SERVER MACHINE.
Database Connections are perfect. But its not working.
Please help me out...
Problem is inside this function.Its works Perfect on my Development Machine
public void CalculateJOBID()
{
DataTable mdt = new DataTable();
int jobid=0;
string qry = "select id as id ,jobid as jid from Jobsheet where id = (select max(id) from Jobsheet where date='"+ DateTime.Now.Date +"')";
mdt = SQLobj.SQL_Adapter(qry);
if (mdt.Rows.Count == 0)
txt_jobid.Text = "1";
else
{
string jid = mdt.Rows[0]["jid"].ToString();
jobid = Convert.ToInt32(jid);
if (mdt.Rows.Count > 0)
{
jobid = jobid + 1;
txt_jobid.Text = jobid.ToString();
}
}
}
推荐答案
public void CalculateJOBID()
{
DataTable mdt = new DataTable();
int jobid=0;
string qry = "select id as id ,jobid as jid from Jobsheet where id = (select max(id) from Jobsheet where date='"+ DateTime.Now.Date +"')";
mdt = SQLobj.SQL_Adapter(qry);
if (mdt.Rows.Count == 0)
jobid=1;
else
{
string jid = mdt.Rows[0]["jid"].ToString();
jobid = Convert.ToInt32(jid);
if (mdt.Rows.Count > 0)
{
jobid = jobid + 1;
}
}
txt_jobid.Text = jobid.ToString();
}
这篇关于ASP.NET服务器端代码无法在服务器计算机上正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!