转会时间表的水晶报告 [英] crystal report for shifting schedule

查看:57
本文介绍了转会时间表的水晶报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于每8小时转移时间表的报告。我的系统有一个登录表单,当你登录时,它将节省您当前登录时与登出相同的时间。但在我的问题中,我只是测试显示loghistory的记录(第一个)如下:



名称:用户名字段

日期:currentdate

Shift开始:登录字段------这是我有问题。只显示第一条记录而不是我登录的当前时间。

班次结束:登出字段





我的代码在我的表格中:



如果ComboBox1.Text =Shift 1然后

Dim rpt As New EndofShift()'你创建的报告。

Dim MyCommand As New SqlCommand()

Dim myDS2 As新的loghistory()'你创建的DataSet。

Dim myDA2 As New SqlDataAdapter()

将myDS视为新的DSactualguesting()'你创建的DataSet。

Dim myDA As New SqlDataAdapter()

Dim cn As New SqlConnection(ConnectString())



尝试



MyCommand.Connection = cn

MyCommand.CommandText =从loghistory选择*,其中username ='+登录.txtuser.Text +'

MyCommand.CommandType = CommandType.Text

myDA.SelectCommand = MyCommand

myDA.Fill(myDS, loghistory)



myDS.EnforceConstraints = False

rpt.SetDataSource(myDS)

CrystalReportViewer1.ReportSource = rpt

Catch Excep As Exception

MessageBox.Show(Excep.Message,Error,MessageBoxButtons.OK,MessageBoxIcon.Error)

结束尝试





结束如果

i have a report for shifting schedule on every 8hours.my system has a login form which is when you login,it will save the time you currently login same with the logout.but in my problem,i was just testing to display the records (first) of the loghistory like this:

Name:username field
Date:currentdate
Shift Start:loggedin field ------ this is were im having a problem.it only display the first record not the current time i have loggedin.
Shift Ends:loggedout field


this my code in my form:

If ComboBox1.Text = "Shift 1" Then
Dim rpt As New EndofShift() 'The report you created.
Dim MyCommand As New SqlCommand()
Dim myDS2 As New loghistory() 'The DataSet you created.
Dim myDA2 As New SqlDataAdapter()
Dim myDS As New DSactualguesting() 'The DataSet you created.
Dim myDA As New SqlDataAdapter()
Dim cn As New SqlConnection(ConnectString())

Try

MyCommand.Connection = cn
MyCommand.CommandText = "Select * from loghistory where username='" + Login.txtuser.Text + "'"
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand
myDA.Fill(myDS, "loghistory")

myDS.EnforceConstraints = False
rpt.SetDataSource(myDS)
CrystalReportViewer1.ReportSource = rpt
Catch Excep As Exception
MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try


End If

推荐答案

尝试将获取的数据限制为您的要求。

您可以在查询中连接您的条件。因此很容易调试并查看获取的结果,然后在report中编写公式。这就是:



Try limiting fetched data as of your requirement.
you can concat your condition in query . So It is easy to debug and see the result fetched then writing formula in report.that is :

MyCommand.CommandText = "Select username,currentdate,loggedin,loggedout from loghistory where username='" + Login.txtuser.Text + "' where  loggedin > 'date of shift' and loggedout > 'date of shift ' ....etc  order by currentdate desc  "







你发现逻辑和错误的详细信息如此之少,只有代码不足以填补您的实际问题。你应该更具描述性。



调试和查看数据集myDS中提取的数据。

myDS是否具有您的条件值?

表格实际存在什么?




you have so less detail about your logic and error you found ,only code is not enough to fill your actual problem. you should be more descriptive .

Debug and view data fetched in your dataset myDS.
Is myDS have values as of your condition ?
what table actualguesting holds?


这篇关于转会时间表的水晶报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆