Avatar of trims30
 asked on

VS2008 Reports

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

Open in new window

Visual Basic.NETCrystal Reports

Avatar of undefined
Last Comment

8/22/2022 - Mon
Éric Moreau

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Jorge Paulino


Excellent article - Got it working - had some difficulty creating dataset from Schema but got past it.

Now to do it again and document what I did.


I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck