parameter problem..

  • Thread starter Carlos via DotNetMonster.com
  • Start date
C

Carlos via DotNetMonster.com

Hi All!
I'm making a web form with 3 dropdown lists(@location, @pool, @name)
There's no compilation error, but when I select rows from those droplists
and then click the button, It returns no values..
(returns only the initial row(index=0))
As soon as clicking the button, it doesn't pass selected value to the
parameter...
What am I going to do???
Here's my code below
Hope you guys can help me out
Many thanks in advance!!




Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data.SqlClient

Public Class WebForm1
Inherits System.Web.UI.Page
..
..
..
..
..
#End Region

Dim crpt As CrystalReport1
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

crpt = New CrystalReport1
For Each myTable In crpt.Database.Tables
myLogin = myTable.LogOnInfo
myLogin.ConnectionInfo.Password = "CKIM"
myLogin.ConnectionInfo.UserID = "CKIM"
myTable.ApplyLogOnInfo(myLogin)
Next

Dim cnn As SqlConnection = New SqlConnection
("Server=***.***.***.***;Database=DB;;UID=****;PWD=****")

Dim cmd As SqlDataAdapter = New SqlDataAdapter("SELECT name11V0
FROM StaffinglocationC195V0", cnn)
Dim ds As DataSet = New DataSet

Dim cmd1 As SqlDataAdapter = New SqlDataAdapter("SELECT name11V0
FROM PoolC278V0", cnn)
Dim ds1 As DataSet = New DataSet

Dim cmd2 As SqlDataAdapter = New SqlDataAdapter("SELECT name FROM
BRT_vw_rep_resource", cnn)
Dim ds2 As DataSet = New DataSet

cmd.Fill(ds)
cmd1.Fill(ds1)
cmd2.Fill(ds2)

DropDownList1.DataSource = ds
DropDownList1.DataTextField = "StaffinglocationC195V0.name11V0"
DropDownList1.DataValueField = "StaffinglocationC195V0.name11V0"
DropDownList1.DataBind()

DropDownList2.DataSource = ds1
DropDownList2.DataTextField = "PoolC278V0.name11V0"
DropDownList2.DataValueField = "PoolC278V0.name11V0"
DropDownList2.DataBind()

DropDownList3.DataSource = ds2
DropDownList3.DataTextField = "BRT_vw_rep_resource.name"
DropDownList3.DataValueField = "BRT_vw_rep_resource.name"
DropDownList3.DataBind()

Dim rows As DataRowCollection = ds.Tables(0).Rows
Dim rows1 As DataRowCollection = ds1.Tables(0).Rows
Dim rows2 As DataRowCollection = ds2.Tables(0).Rows

Dim i As Integer = 0
While i < rows.Count
Dim s As String = rows(i)("name11V0").ToString
DropDownList1.Items.Add(New ListItem(s))
System.Math.Min(System.Threading.Interlocked.Increment(i), i -
1)
End While

Dim j As Integer = 0
While j < rows1.Count
Dim t As String = rows1(j)("name11V0").ToString
DropDownList2.Items.Add(New ListItem(t))
System.Math.Min(System.Threading.Interlocked.Increment(j), j -
1)
End While

Dim k As Integer = 0
While k < rows2.Count
Dim u As String = rows2(k)("name").ToString
DropDownList3.Items.Add(New ListItem(u))
System.Math.Min(System.Threading.Interlocked.Increment(k), k -
1)
End While

DropDownList1.Items.Insert(0, "*")
DropDownList2.Items.Insert(0, "*")
DropDownList3.Items.Insert(0, "*")

'crpt.SetParameterValue("@sqldrp_Location",
DropDownList1.SelectedItem.Value)
'crpt.SetParameterValue("@sqldrp_ResourcePool",
DropDownList2.SelectedItem.Value)
'crpt.SetParameterValue("@sqldrp_ResourceName",
DropDownList3.SelectedItem.Value)

CrystalReportViewer1.ReportSource = crpt

End Sub

Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList1.SelectedIndexChanged

End Sub

Private Sub DropDownList2_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList2.SelectedIndexChanged

End Sub

Private Sub DropDownList3_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList3.SelectedIndexChanged

End Sub

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

crpt.SetParameterValue("@sqldrp_Location",
DropDownList1.SelectedItem.Text)
crpt.SetParameterValue("@sqldrp_ResourcePool",
DropDownList2.SelectedItem.Value)
crpt.SetParameterValue("@sqldrp_ResourceName",
DropDownList3.SelectedItem.Value)

End Sub
End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top