Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 4th, 2006, 11:14 PM
Authorized User
 
Join Date: Feb 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Parameterized CRystal report & Stored procedure

hello all

i have 1 table feld having no ,name

i have one textbox when i input name it should return me according to name (input) i gave

and in report i have Inserted both field (no ,name) while it is being asked while i added it from new Item



Problem is This code shows all record in table and i can not see any Parameter in with TICK sign even if i put it on as a new parameter in field Explorer.


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Not IsPostBack Then

Dim crpt As New cr1 (crytal report object )

Dim cn As New SqlConnection("workstation id=JIG;packet size=4096;integrated security=SSPI;data source=jig;persist security info=False;initial catalog=xx")

Dim cmd As New SqlCommand("sp1", cn)

cmd.CommandType = CommandType.StoredProcedure

cmd.Parameters.Add("@p1", txt1.Text)

Dim da As New SqlDataAdapter(cmd)

da.Fill(ds)

crpt.SetDataSource(ds)

crw.ReportSource = crpt (crystal report viewer object)

End If



my Sp1 is

ALTER PROCEDURE

dbo.sp1
@p1 varchar


AS

select * from tbl Where name='@p1'

RETURN


pls help me ......
 
Old June 5th, 2006, 10:23 AM
Registered User
 
Join Date: Apr 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

cmd.Parameters.Add("parm1",Sring) means u r adding a parameter to command not assiging a value to sp's parameter (or to cmd parameter)

use cmd.Parameters("parm1").value = textbox.value
or
use cmd.Parameters(0).vaue = textBox.value

to assign value to parameter.
i think i understood ur pronlem and this may be the solution to ur problem.
take care bye for now

 
Old June 5th, 2006, 11:30 AM
Authorized User
 
Join Date: Feb 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

no sir my prob is there !!! :(

hello sir i did u said but my AIM is :

1)to create a PARAM in Crystal reports
 (i did is successfully :))

2)pass the value from Textbox as Crystapl report PARAM to Stored procedure and retrieve the report on screen

i tried so many things i ams stucked at 2nd how to pass this values

 
Old June 6th, 2006, 08:53 AM
Registered User
 
Join Date: Apr 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

well first check ur sp. wheather records are returned or not ...
second try to use Formula rather using Parameters in report ...
U can also use ReplaceSelectionFormula of report direct rather passing value to sp then execute it to generate report against each name criteria ...
i dont understand one thing why r u using report parameter to pass value to it mean while u r passing criteria to sp that will also return a single row or multiple row against name; providing from text field.
(this is what i understand ur problem & giving reponse)
take care






Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal Report, Stored Procedure, Dataset clioz Crystal Reports 0 July 19th, 2006 06:28 PM
Setting up stored procedure for Crystal Report.... potato3 SQL Language 1 December 9th, 2004 12:33 PM
SQL Stored Procedure & VB6 acdsky VB Databases Basics 1 September 29th, 2004 10:01 AM
Problem In Parameterized ADO.NET Stored Procedure yoord ADO.NET 3 June 19th, 2004 05:09 AM
Pass parameter to store procedure & Crystal Report quinn Classic ASP Professional 0 March 10th, 2004 02:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.