在VB.NET中使用存储过程运行Crystal报表 [英] Running Crystal report with a stored procedure in VB.NET

查看:64
本文介绍了在VB.NET中使用存储过程运行Crystal报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用以下SP运行CR报告的VB语法是什么?

我使用CrystalreportViewer和ReportDocument。

谢谢

Bill

这里是SQLserver 2K中的SP:


CREATE proc mysp_ReportSubmission

@salesdate as varchar(20) ,

@inflag as bit

AS

if @inflag = 0

select * from不活动的站点= 0

和stationid不在

(从交易中选择stationid

,其中transdate = @salesdate)


其他


选择*来自车站,其中无效= 0

和stationid in

(选择来自交易

其中transdate = @salesdate)


GO

What''s the VB syntax to run the CR report using the following SP?
I use CrystalreportViewer and ReportDocument.
Thanks
Bill
Here''s the SP in SQLserver 2K:

CREATE proc mysp_ReportSubmission
@salesdate as varchar(20),
@inflag as bit
AS
if @inflag = 0

select * from station where inactive = 0
and stationid not in
(select stationid from transactions
where transdate = @salesdate)

else

select * from station where inactive = 0
and stationid in
(select stationid from transactions
where transdate = @salesdate)

GO

推荐答案

您好比尔,


简单地构建报告,数据源是你的slq服务器和

sp - 一旦你连接了它,它将作为数据源提供港口到

您的服务器。


HTH,


Bernie Yaeger


Bill Nguyen <双***************** @ jaco.com>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
Hi Bill,

Simply build the report with the datasource being your slq server and the
sp - it will be available as a datasource once you connect the report to
your server.

HTH,

Bernie Yaeger

"Bill Nguyen" <bi*****************@jaco.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
什么'使用以下SP运行CR报告的VB语法?
我使用CrystalreportViewer和ReportDocument。
谢谢
比尔

这里是SP in SQLserver 2K:

CREATE proc mysp_ReportSubmission
@salesdate as varchar(20),
@inflag as bit
AS
如果@inflag = 0

从车站选择*不活动= 0
和站点不在
(从交易中选择stationid
其中transdate = @salesdate)

其他

选择*来自不活动的站点= 0
和站点在
(从交易中选择stationid
其中transdate = @salesdate)

GO
What''s the VB syntax to run the CR report using the following SP?
I use CrystalreportViewer and ReportDocument.
Thanks
Bill
Here''s the SP in SQLserver 2K:

CREATE proc mysp_ReportSubmission
@salesdate as varchar(20),
@inflag as bit
AS
if @inflag = 0

select * from station where inactive = 0
and stationid not in
(select stationid from transactions
where transdate = @salesdate)

else

select * from station where inactive = 0
and stationid in
(select stationid from transactions
where transdate = @salesdate)

GO



感谢Bernie;

问题是如何在运行时提供SP的参数。

参数对于CR和SQLserver具有不同的格式。我应该提供哪一个?b $ b?我们将非常感谢代码示例。

谢谢

比尔


" Bernie Yaeger" <是***** @ cherwellinc.com>在消息中写道

news:eZ ************** @ tk2msftngp13.phx.gbl ...
Thanks Bernie;
The question is how to provide the SP''s parameters at run time. The
parameters are of different formats for CR and for SQLserver. Which one
should I provide? A sample of the codes would be greatly appreciated.
Thanks
Bill

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:eZ**************@tk2msftngp13.phx.gbl...
嗨比尔, sp - 一旦您将报告连接到您的服务器,它将作为数据源提供。

HTH,

Bernie Yaeger

Bill Nguyen <双***************** @ jaco.com>在消息中写道
新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
Hi Bill,

Simply build the report with the datasource being your slq server and the
sp - it will be available as a datasource once you connect the report to
your server.

HTH,

Bernie Yaeger

"Bill Nguyen" <bi*****************@jaco.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
什么是VB使用以下SP运行CR报告的语法?
我使用CrystalreportViewer和ReportDocument。
谢谢
Bill

这里是SQLserver 2K中的SP:

CREATE proc mysp_ReportSubmission
@salesdate as varchar(20),
@inflag as bit
AS
如果@inflag = 0

select * from station where inactive = 0
and stationid not in
(从事务中选择stationid
where transdate = @salesdate)



选择*来自不活动的站点= 0
和站点在
(从交易中选择stationid
其中transdate = @salesdate)

GO
What''s the VB syntax to run the CR report using the following SP?
I use CrystalreportViewer and ReportDocument.
Thanks
Bill
Here''s the SP in SQLserver 2K:

CREATE proc mysp_ReportSubmission
@salesdate as varchar(20),
@inflag as bit
AS
if @inflag = 0

select * from station where inactive = 0
and stationid not in
(select stationid from transactions
where transdate = @salesdate)

else

select * from station where inactive = 0
and stationid in
(select stationid from transactions
where transdate = @salesdate)

GO




比尔,


我已放置在以下样本中代码我用来将参数传递给cr

reportviewer。我使用case语句并在.vb文件中运行它。

称为''reportprinter_param.vb''。它向您展示了如何将多个

参数传递给报告(基本上是一个4步过程)。在

报告中是参数,其名称与下面列出的

''paramfield.parameterfieldname''变量中的名称相匹配。

如果您有任何疑问,请告诉我。

Case" f:\ imcapps \statesummary.rpt"," f:\ imcapps \ zipsummary.rpt"


paramField.ParameterFieldName =" mtitle"


paramField2.ParameterFieldName =" mbipad"


paramField3.ParameterFieldName = QUOT;米苏"


discreteVal.Value = mglobals.gl_magvar


discreteVal2.Value = mglobals.gl_bipvar <无线电通信/>

discreteVal3.Value = mglobals.gl_issuevar


paramField.CurrentValues.Add(discreteVal)


paramField2 .CurrentValues.Add(discreteVal2)


paramField3.CurrentValues.Add(discreteVal3)


paramFields.Add(paramField)


paramFields.Add(paramField2)


paramFields.Add(paramField3)

CrystalReportViewer1.ParameterFieldInfo = paramFields


CrystalReportViewer1.ReportSource = gl_browseprintvar


HTH,


伯尼


" Bill Nguyen" <双***************** @ jaco.com>在消息中写道

新闻:eE ************** @ TK2MSFTNGP10.phx.gbl ...
Hi Bill,

I have placed below a sample of code I use to pass parameters to the cr
reportviewer. I use a case statement and run this all within a .vb file
called ''reportprinter_param.vb''. It shows you how to pass multiple
parameters to the report (in, essentially, a 4 step process). Inside the
report are the parameters, the names of which match the names in the
''paramfield.parameterfieldname'' variable listed below.

Let me know if you have any questions.
Case "f:\imcapps\statesummary.rpt", "f:\imcapps\zipsummary.rpt"

paramField.ParameterFieldName = "mtitle"

paramField2.ParameterFieldName = "mbipad"

paramField3.ParameterFieldName = "missue"

discreteVal.Value = mglobals.gl_magvar

discreteVal2.Value = mglobals.gl_bipvar

discreteVal3.Value = mglobals.gl_issuevar

paramField.CurrentValues.Add(discreteVal)

paramField2.CurrentValues.Add(discreteVal2)

paramField3.CurrentValues.Add(discreteVal3)

paramFields.Add(paramField)

paramFields.Add(paramField2)

paramFields.Add(paramField3)

CrystalReportViewer1.ParameterFieldInfo = paramFields

CrystalReportViewer1.ReportSource = gl_browseprintvar

HTH,

Bernie

"Bill Nguyen" <bi*****************@jaco.com> wrote in message
news:eE**************@TK2MSFTNGP10.phx.gbl...
感谢Bernie; 参数具有不同的格式。我应该提供哪一个?我们将非常感谢代码示例。
谢谢


  Bernie Yaeger" <是***** @ cherwellinc.com>在消息中写道
新闻:eZ ************** @ tk2msftngp13.phx.gbl ...
Thanks Bernie;
The question is how to provide the SP''s parameters at run time. The
parameters are of different formats for CR and for SQLserver. Which one
should I provide? A sample of the codes would be greatly appreciated.
Thanks
Bill

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:eZ**************@tk2msftngp13.phx.gbl...
嗨比尔,
sp - 一旦将报告连接到服务器,它将作为数据源提供。

HTH ,

Bernie Yaeger

Bill Nguyen <双***************** @ jaco.com>在消息中写道
新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
Hi Bill,

Simply build the report with the datasource being your slq server and the sp - it will be available as a datasource once you connect the report to
your server.

HTH,

Bernie Yaeger

"Bill Nguyen" <bi*****************@jaco.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
什么是VB使用以下SP运行CR报告的语法?
我使用CrystalreportViewer和ReportDocument。
谢谢
Bill

这里是SQLserver 2K中的SP:

CREATE proc mysp_ReportSubmission
@salesdate as varchar(20),
@inflag as bit
AS
如果@inflag = 0

select * from station where inactive = 0
and stationid not in
(从事务中选择stationid
where transdate = @salesdate)



选择*来自不活动的站点= 0
和站点在
(从交易中选择stationid
其中transdate = @salesdate)

GO
What''s the VB syntax to run the CR report using the following SP?
I use CrystalreportViewer and ReportDocument.
Thanks
Bill
Here''s the SP in SQLserver 2K:

CREATE proc mysp_ReportSubmission
@salesdate as varchar(20),
@inflag as bit
AS
if @inflag = 0

select * from station where inactive = 0
and stationid not in
(select stationid from transactions
where transdate = @salesdate)

else

select * from station where inactive = 0
and stationid in
(select stationid from transactions
where transdate = @salesdate)

GO





这篇关于在VB.NET中使用存储过程运行Crystal报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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