【求救!】C#.net 标准表达式中数据类型不匹配 以下Money为货币类型字段 用百度hi 联系我
主要实现,当某一UserID下,AccountLog中direction为IN的Money总和减去OUT的Money总和,最后两者相减,在名为balance的label上...
主要实现,当某一UserID下,AccountLog中direction为IN的Money总和减去OUT的Money总和,最后两者相减,在名为balance的label上显示
主要代码:
private void BalanceInquire_Load(object sender, EventArgs e)
{
OleDbConnection oc = new OleDbConnection(ConfigurationManager.ConnectionStrings["ButterflyConnectionString"].ConnectionString);
oc.Open();
String strin = "select SUM([Money]) As income from AccountLog where UserID='" + BIUserID + "' and Direction ='IN'";
String strout = "select SUM([Money]) As payment from AccountLog Where UserID='" + BIUserID + "' and Direction = 'OUT'";
OleDbCommand comin = new OleDbCommand(strin);
comin.Connection = oc;
OleDbDataReader drin = comin.ExecuteReader();
OleDbCommand comout = new OleDbCommand(strout);
comin.Connection = oc;
OleDbDataReader drout = comout.ExecuteReader();
try
{
drin.Read();
drout.Read();
balance.Text = ((decimal)drin["income"] - (decimal)drout["payment"]).ToString();
}
catch(Exception ex)
{
balance.Text = ex.Message;
}
finally
{
drin.Close();
drout.Close();
oc.Close();
}
}
}
补充:现在第二句comin.Connection = oc;已改成comout.Connection = oc; 另外前面有代码:private static int BIUserID;
public BalanceInquire(int l1)
{
InitializeComponent();
BIUserID = l1;
}
而,再到退前面一个窗体
private void 余额查询ToolStripMenuItem_Click(object sender, EventArgs e)
{
ManageAccount.BalanceInquire frm = new ManageAccount.BalanceInquire(Login.USERID);
frm.MdiParent = this;
frm.Show();
}
再到退到主启动窗体:
public static int USERID; 这是USERID字段的定义
拜托!!!高手帮帮我啊!!!!满意的话我多给您加5分! 展开
主要代码:
private void BalanceInquire_Load(object sender, EventArgs e)
{
OleDbConnection oc = new OleDbConnection(ConfigurationManager.ConnectionStrings["ButterflyConnectionString"].ConnectionString);
oc.Open();
String strin = "select SUM([Money]) As income from AccountLog where UserID='" + BIUserID + "' and Direction ='IN'";
String strout = "select SUM([Money]) As payment from AccountLog Where UserID='" + BIUserID + "' and Direction = 'OUT'";
OleDbCommand comin = new OleDbCommand(strin);
comin.Connection = oc;
OleDbDataReader drin = comin.ExecuteReader();
OleDbCommand comout = new OleDbCommand(strout);
comin.Connection = oc;
OleDbDataReader drout = comout.ExecuteReader();
try
{
drin.Read();
drout.Read();
balance.Text = ((decimal)drin["income"] - (decimal)drout["payment"]).ToString();
}
catch(Exception ex)
{
balance.Text = ex.Message;
}
finally
{
drin.Close();
drout.Close();
oc.Close();
}
}
}
补充:现在第二句comin.Connection = oc;已改成comout.Connection = oc; 另外前面有代码:private static int BIUserID;
public BalanceInquire(int l1)
{
InitializeComponent();
BIUserID = l1;
}
而,再到退前面一个窗体
private void 余额查询ToolStripMenuItem_Click(object sender, EventArgs e)
{
ManageAccount.BalanceInquire frm = new ManageAccount.BalanceInquire(Login.USERID);
frm.MdiParent = this;
frm.Show();
}
再到退到主启动窗体:
public static int USERID; 这是USERID字段的定义
拜托!!!高手帮帮我啊!!!!满意的话我多给您加5分! 展开
2个回答
光点科技
2023-08-15 广告
2023-08-15 广告
通常情况下,我们会按照结构模型把系统产生的数据分为三种类型:结构化数据、半结构化数据和非结构化数据。结构化数据,即行数据,是存储在数据库里,可以用二维表结构来逻辑表达实现的数据。最常见的就是数字数据和文本数据,它们可以某种标准格式存在于文件...
点击进入详情页
本回答由光点科技提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询