troubleshooting Question

VS2008 Reports

Avatar of trims30
trims30 asked on
Crystal ReportsVisual Basic.NET
3 Comments1 Solution663 ViewsLast Modified:
Need assistance writing my first report in VS2008 (VB.Net) Winforms.
Am new to this environment and don't know how to begin creating a report.

I have a database and am using SQLServer2012 and there are no compatible drivers for SqlServer2012 available for VS2008 to my knowledge so I can't use the ReportViewer Wizards to access my database.

Code below is what I'm using to create a DataTable.  "MyData"

I would like to get a report showing the 5 columns for each row.

Any help would be appreciated - Got to learn this stuff!

Tools I have are whatever comes with VS2008 MsReportViewer, CrystalReportViewer, CrystalReportDocument.


Imports System.Data.SqlClient
Imports System.Data.DataTable
Public Class Form1
    Dim Conn As SqlConnection
    Dim myCommand As New SqlCommand
    Dim myAdapter As New SqlDataAdapter
    Dim myData As New DataTable
    Dim sql As String
    Dim myConnString As String

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Conn = New SqlConnection()        'Set New Instance of Sql Connection
        myConnString = "Data Source=LEE-PC;" & _
        "Initial Catalog=TRIMS_SQL_Data_2012;" & _
        "Integrated Security=True"

        Conn.ConnectionString = myConnString

            Conn.Open()                     'Open Connection
        Catch myerror As SqlException
            MessageBox.Show("Error connecting to the database: " & myerror.Message)
        End Try

        sql = "SELECT * FROM Budget_Transactions WHERE Trans_ID > 30 ORDER BY Trans_ID"
            myCommand.Connection = Conn                     'pass connection to Command Object
            myCommand.CommandText = sql                     'pass Sql command 

            myAdapter.SelectCommand = myCommand             'assign command to Data Adaptor

        Catch myerror As SqlException
            MsgBox("There was an error reading from the database: " & myerror.Message)
        End Try

    End Sub
End Class
Éric Moreau
Senior .Net Consultant
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros