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.
Lee
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.
Lee
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
Try
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"
Try
myCommand.Connection = Conn 'pass connection to Command Object
myCommand.CommandText = sql 'pass Sql command
myData.Clear()
myAdapter.SelectCommand = myCommand 'assign command to Data Adaptor
myAdapter.Fill(myData)
Catch myerror As SqlException
MsgBox("There was an error reading from the database: " & myerror.Message)
End Try
End Sub
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
Thanks.
Lee
Now to do it again and document what I did.
Thanks.
Lee
https://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/A_3911-Microsoft-Reporting-Services-Sub-Reports-Charts-Parameters-Expression-Editor-etc.html