|
Hello
I have to pass parameters to crystal report at runtime,i have already created reports in crystal report 9,below is my code
Dim reportdocument As New ReportDocument
Dim strRptPath As String
strRptPath = "d:\Attendance System\Attendance Reports\TodayAbsRpt.rpt"
reportdocument.Load(strRptPath)
Dim paramdefs As ParameterFieldDefinitions
Dim paramdef As ParameterFieldDefinition
Dim paramvalues As New ParameterValues
Dim paramdisval As New ParameterDiscreteValue
Dim todayval As Long
todayval = Me.DTPsdate.Text.Substring(6, 4) & Mid(Me.DTPsdate.Text, 4, 2) & Me.DTPsdate.Text.Substring(0, 2)
paramdefs = reportdocument.DataDefinition.ParameterFields
For Each paramdef In paramdefs
With paramdef
Select Case .ParameterFieldName
Case "DpttNm"
paramdisval.Value = "'" & Me.cmbDptt.Text & "'"
paramvalues.Add(paramdisval)
paramdef.ApplyCurrentValues(paramvalues)
Case "pDate"
paramdisval.Value = todayval
paramvalues.Add(paramdisval)
paramdef.ApplyCurrentValues(paramvalues)
End Select
End With
Next
Dim frm As New FrmRpt
frm.crViewer1.reportSource=reportdocument
frm.Show()
the crystal report viewet is on another form ....the problem is that the crystal
report viewer doe'snt load the report
please help me ur corporation is highly appreciated
thanks
|
|
|
|
|
Please add a single line after the following Line:
frm.crViewer1.reportSource=reportdocument;
crViewer1.Show();
frm.Show();
|
|
|
|
|
Hi,
does anyone know hot to join two arrays into a third final array?
The end of the first arrays is the start of the second array.
Thanks!
|
|
|
|
|
You could write a function
Private Function JoinArrays(Array1() as string, Array2() as string) as string()<br />
dim Array3() as string<br />
for count as integer = 0 to Array1.length - 1<br />
Array3(count)=Array1(count)<br />
next count<br />
<br />
for count =0 to array2.length - 1<br />
array3(array1.length+count)=array2(count)<br />
next count<br />
return array3<br />
End Sub
|
|
|
|
|
A simpler way to do it:
Public Shared Function JoinStringArrays(ByVal source1 As String(), ByVal source2 As String()) As String()
Dim newArray(source1.Length + source2.Length - 1)
source1.CopyTo(newArray, 0)
source2.CopyTo(newArray, source1.Length)
return newArray
End Function
|
|
|
|
|
hi All
i would like to know how to design a Function that accept parameters and return a dataset. Inputs are from a textbox.
please provide example code or article or Tutorial
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Vuyiswamb wrote: i would like to know how to design a Function that accept parameters and return a dataset. Inputs are from a textbox.
Where the information initially came from is unimporant to the method, it will know nothing about your text box.
Public Function MyFunction(someText As String) As DataSet
Dim result As DataSet
' Do stuff to generate the dataset and assign it to result
Return result
End Function
|
|
|
|
|
I can't help but feel that your (100% correct) response isn't going to get him much further along....
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks Colin
I want to understand you Correctly
i have command text that will get records from my table based on a lis_key field that is substringed in SQl like this
SELECT Primary_ID, Boundary_area, Attrib_Code, Lis_Key, Func_Key, Actual_Extent, Improved_Value, Site_Value, Purchase_price, Purchase_date, prop_id, confidence_score, fin_ls_prediction, new_lis_key, new_func_key, Tshwane_Prediction FROM Property_mass WHERE (SUBSTRING(Lis_Key, 1, 4) = @Lis_key)
And i have a Function as you said that must accept the paramer and return a dataset like this
Public Function GetdataProperties_lissearch(ByVal strSearched As String) As Dataset<br />
<br />
Dim dsdata As dssearchlis<br />
<br />
Try<br />
dsdata = New dssearchlis<br />
dasearchlis.Fill(dsdata)<br />
<br />
Catch ex As SqlClient.SqlException<br />
MsgBox(ex.Message)<br />
End Try<br />
<br />
Return dsdata<br />
<br />
End Function<br />
<br />
I want to know how will i get the Adapter to Accept the Parameter passed.
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Vuyiswamb wrote: I want to know how will i get the Adapter to Accept the Parameter passed.
The adapter doesn't the command does. The adapter will have a SelectCommand or some such property.
|
|
|
|
|
Sorry about that. the Adapter Property SelectedCommand will do i know. its just that i moved to OOPS and N-tier Development, so the Classes confused me a lot, but i got the Answer. i have a Function in my DAL layer. coded like this
Public Function GetdataProperties_lissearch(ByVal strSearched As String) As DataSet
Dim dsdata As dssearchlis
Try
dsdata = New dssearchlis
dasearchlis.SelectCommand.Parameters("@Lis_key").Value = strSearched
dasearchlis.Fill(dsdata)
If dsdata.Tables("Property_Mass").Rows.Count = 0 Then
MsgBox("Township not Found", MsgBoxStyle.OKOnly, "Warning")
Else
dsdata.Clear()
dasearchlis.Fill(dsdata)
Return dsdata
End If
Catch ex As SqlClient.SqlException
MsgBox(ex.Message)
End Try
Return dsdata
End Function
And am Calling this Function from the BLL and here is the Code that is Call this Function from a BLL
Public Function Getdata_Lis_search(ByVal strSearched As String) As DataSet
Dim ws As PropDAL.Properties
Dim dsdata As DataSet
Try
ws = New PropDAL.Properties
dsdata = New DataSet
dsdata = ws.GetdataProperties_lissearch(strSearched)
Return dsdata
Catch ex As SqlClient.SqlException
MsgBox(ex.Message)
End Try
End Function
And in my Form Search button am Calling the Fuction in the BLL like this
mResvalue = txtlisSearch.Text
Dim objBUs As ProBusiness.Properties
Try
mdsprops_lis = New PropDAL.dssearchlis
objBUs = New ProBusiness.Properties
objBUs.Getdata_Lis_search(Resvalue)
mdsprops_lis = objBUs.Getdata_Lis_search(mResvalue)
dgr.DataMember = "Property_Mass"
dgr.DataSource = mdsprops_lis
Catch ex As SqlClient.SqlException
MessageBox.Show(ex.Message)
End Try
And Another module level dataset inheriting from DAL, i dont know if this is the Good idea, because everything should not bypass BLL ,
Private mdsprops_lis As PropDAL.dssearchlis
PLease comment on this one, because it gives me Errors when i instatiate from BLL
Thanks again Colin
but everything is working fine.
and i have Declared module level string Variables
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Vuyiswamb wrote: i have a Function in my DAL layer. coded like this
Vuyiswamb wrote: If dsdata.Tables("Property_Mass").Rows.Count = 0 Then MsgBox("Township not Found", MsgBoxStyle.OKOnly, "Warning")
Invoking a message box from the DAL is highly inappropriate. You should have zero user interface code in there. To do otherwise would break the concept of abstracting away the Data layer away from the presentation layer.
Vuyiswamb wrote: PLease comment on this one, because it gives me Errors when i instatiate from BLL
What sort of errors?
|
|
|
|
|
Hi Colin
|Colin wrote
Invoking a message box from the DAL is highly inappropriate. You should have zero user interface code in there. To do otherwise would break the concept of abstracting away the Data layer away from the presentation layer.
You are right. So its that i should Fill the dataset and Trap the user input from the BLL. it makes sense, after all thats where its Supposed to Happen. let me do it that way.
|Colin wrote
What sort of errors?
In the Following code am declaring a module level dataset through a BLL instatiating from DAL. i wrote this code like this .
Private mdsprops_lis As PropDAL.dssearchlis
And i wished it would look like this
Private mdsprops_lis As ProBLL.PropDAL.dssearchlis
but when i try that it gives me Exception, i think it has to do with the way i have designed my DAL and my BLL, but am looking at it, and am open for Suggestion.
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Hi
Has any one out there used crystal with sql server to generate reports? I have been trying to get my code running that passes my login info and password to sql automatically. I have followed the instructions in the MSDN to set up these reports and one of the variables which I know I have declared is simply not being picked up.
The code I ahve been making use of is as follows
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.ReportSource
Public Class Form1
Private Sub configurecrystalreports()
Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
myConnectionInfo.DatabaseName = "Northwind"
myConnectionInfo.UserID = "limitedPermissionAccount"
myConnectionInfo.Password = "1234"
Dim reportpath As String = Application.StartupPath & "\" & "northwind.rpt"
myCrystalReportViewer.ReportSource = reportpath
setdblogforreport(myConnectionInfo)
End Sub
Private Sub setdblogforreport(ByVal myconnectioninfo As ConnectionInfo)
Dim mytablelogoninfo As TableLogOnInfos = myCrystalReportViewer.LogOnInfo
For Each myTableLogOnInfo As TableLogOnInfo In [myTableLogOnInfos] ' vbstates that I 'have not declared mytablelogonInfo.
myTableLogOnInfo.ConnectionInfo = myconnectioninfo
Next
End Sub
I have gone over the instructions in the MSDN several times and I am still getting the same error.
What am I doing wrong, or is there an easier way of doing this that is not using the wizards?
|
|
|
|
|
twsted f8 wrote: Dim mytablelogoninfo As TableLogOnInfos = myCrystalReportViewer.LogOnInfo
twsted f8 wrote: For Each myTableLogOnInfo As TableLogOnInfo In [myTableLogOnInfos]
Is that the difference, maybe?
|
|
|
|
|
i need help how write window application to send email in visual studio .net 2005(a sample code for sending email )
suhail ali
|
|
|
|
|
Wow[^] - the first hit was this very site.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi all,
can an object created for abstract class and interface?
can i use a static method in abstract class?
if i am using all methods in abstract class as abstract method then how it vary from interface.why cannot i use an interface instead.
ganesh
ganesh
|
|
|
|
|
Ganesh RV wrote: can an object created for abstract class and interface?
I don't understand the question
Ganesh RV wrote: can i use a static method in abstract class?
I wasn't sure, but it took 5 seconds to type one into the compiler and build it, so yes.
Ganesh RV wrote: if i am using all methods in abstract class as abstract method then how it vary from interface.why cannot i use an interface instead.
A base class is a base class, all sorts of different classes can have the same interface. So, use the tool that suits.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i want know about localization resources.anyone can help me ...to know that..please give some example code....
ganash
|
|
|
|
|
Build your strings in a resource file, build resource files for each language.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i want to fetch the word from databse in the format of to eliminate the spaces in the middle of the word.please tell me solution for that problem
ganash
|
|
|
|
|
Hi...
i am not exactly getting what you are trying to do... I will tel you from what i understood...
If u want to truncate the blank spaces from begning or/and end of a string you can use trim...
Eg:
dim a1 as string
dim a2 as string
a1 = " test string "
a2 = trim(a1)
this will store "test string" in a2 and spaces will be removed
may be this will be of some help...
If not plz describe what exactly you want
Good luck
|
|
|
|
|
thanks for ur reply
i explain it my question
ex:
let us assume the word stored in database like
"jo in"
in my need is retrieving the word like
"join"
i think u can understood now
my need is to eliminate the blank space at the middle of the word
ok
thank you
tell the solution please
ganash
|
|
|
|
|
String.Replace(" ","") should do it.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|