Click here to Skip to main content
15,902,447 members
Home / Discussions / Database
   

Database

 
GeneralRe: VB.NET Console application and SQLServer Pin
sybux200011-Aug-04 19:28
sybux200011-Aug-04 19:28 
GeneralRe: VB.NET Console application and SQLServer Pin
sybux200012-Aug-04 2:59
sybux200012-Aug-04 2:59 
QuestionSELECT statements in INNER JOINs? Pin
MS le Roux11-Aug-04 4:16
MS le Roux11-Aug-04 4:16 
AnswerRe: SELECT statements in INNER JOINs? Pin
Michael Potter11-Aug-04 4:26
Michael Potter11-Aug-04 4:26 
AnswerRe: SELECT statements in INNER JOINs? Pin
Colin Angus Mackay11-Aug-04 4:31
Colin Angus Mackay11-Aug-04 4:31 
Questionhow to bind crystal reports Pin
jaan leva11-Aug-04 1:55
jaan leva11-Aug-04 1:55 
AnswerRe: how to bind crystal reports Pin
Member 53081012-Aug-04 3:20
Member 53081012-Aug-04 3:20 
GeneralRe: how to bind crystal reports - Use this code Pin
cvp7712-Aug-04 21:34
cvp7712-Aug-04 21:34 
Private Sub ShowReport()
Dim rpt As New CrystalReport1() 'The report you created
Dim dsReport As New Dataset1() 'The dataset that you created for this report
'We need a report object that is fully populated to display, so declare one
Dim objReport As Object

objReport = prepareReport(rpt, dsReport, "SELECT * FROM MyTable")
rpvReport.ReportSource = objReport
End Sub


'To get a report from Table

Public Overloads Function prepareReport(ByVal rpt As Object, ByVal dsReport As Object, ByVal tblName As String) As Object

Dim myConnection As SqlConnection
Dim MyCommand As New SqlClient.SqlCommand()
Dim MyDA As New SqlDataAdapter()
Try
myConnection = New SqlConnection("Data Source=localhost;Integrated Security=SSPI;" & _
"Initial Catalog=northwind;")
MyCommand.Connection = myConnection
MyCommand.CommandText = tblName
MyCommand.CommandType = CommandType.Text
MyDA.SelectCommand = MyCommand
MyDA.Fill(dsReport, “MyTable”)
rpt.SetDataSource (dsReport)
Return rpt
Catch ReportErr As Exception
Reponse.write("Prepare Report Error:" & ReportErr.Message)
Finally
MyDA.Dispose()
MyCommand.Dispose()
myConnection.Dispose()
End Try

End Function

Things to do before Coding.
1.Create a dataset (named dataset1) which has to bind the
necessary table or view (in this case it is MyTable)in the integrated environment.

2.Create a Report (in this eg -CrystalReport1) and bind the report with the dataset you have created(Dataset1)

3.Drag and drop the necessary fields

4.Use the code

5.Ur Report is ready Smile | :)

Things To Ensure:
Check whether you have 2 import statements in your vb
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared


Regards,
CVP

GeneralMSDE Pin
Renjith Ramachandran11-Aug-04 0:04
Renjith Ramachandran11-Aug-04 0:04 
GeneralRe: MSDE Pin
Renjith Ramachandran13-Aug-04 1:03
Renjith Ramachandran13-Aug-04 1:03 
GeneralRe: MSDE Pin
Blake V. Miller25-Oct-04 19:56
Blake V. Miller25-Oct-04 19:56 
QuestionWhy Procedures? Pin
Sumit Domyan10-Aug-04 7:32
Sumit Domyan10-Aug-04 7:32 
AnswerRe: Why Procedures? Pin
VenkatFor.NET10-Aug-04 8:06
VenkatFor.NET10-Aug-04 8:06 
GeneralRe: Why Procedures? Pin
Michael Potter11-Aug-04 4:37
Michael Potter11-Aug-04 4:37 
AnswerRe: Why Procedures? Pin
munawarhussain11-Aug-04 5:02
munawarhussain11-Aug-04 5:02 
GeneralSQL Server Connection Attempt Never Times Out Pin
shultas10-Aug-04 5:24
shultas10-Aug-04 5:24 
Generalvery urgent - pls help: sql server data screwed Pin
matthias s.9-Aug-04 4:07
matthias s.9-Aug-04 4:07 
GeneralRe: very urgent - pls help: sql server data screwed Pin
Bill Dean9-Aug-04 5:56
Bill Dean9-Aug-04 5:56 
GeneralRe: very urgent - pls help: sql server data screwed Pin
matthias s.9-Aug-04 13:39
matthias s.9-Aug-04 13:39 
GeneralRe: very urgent - pls help: sql server data screwed Pin
Colin Angus Mackay9-Aug-04 6:11
Colin Angus Mackay9-Aug-04 6:11 
GeneralRe: very urgent - pls help: sql server data screwed [addendum] Pin
Colin Angus Mackay9-Aug-04 6:17
Colin Angus Mackay9-Aug-04 6:17 
GeneralRe: very urgent - pls help: sql server data screwed [addendum] Pin
matthias s.9-Aug-04 13:42
matthias s.9-Aug-04 13:42 
GeneralFOR XML EXPLICIT Pin
Anonymous9-Aug-04 3:17
Anonymous9-Aug-04 3:17 
GeneralNormalization question Pin
Roger Alsing8-Aug-04 20:23
Roger Alsing8-Aug-04 20:23 
GeneralRe: Normalization question Pin
slvrscremr9-Aug-04 3:31
slvrscremr9-Aug-04 3:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.