SELECT NameEn, Code, COUNT(*) AS Total
FROM dbo.vwu_Reports
Group By NameEn, Code
ORDER BY NameEn, Code
i have created similar Views and stored procedure for all the other database (database names depict the location)
how do i switch in VB.NET to the different database (location) upon selecting the location from a comboBox. I am using crystal report 9 for reporting.
Could u please help me get it working ..... i am really stuk and getting behind schedule.
the VB.NET code looks something like this:
Expand|Select|Wrap|Line Numbers
- Public Sub SetLogonInfo()
- Try
- LogInfo.ConnectionInfo.ServerName = strDataSource
- LogInfo.ConnectionInfo.UserID = strUserId
- LogInfo.ConnectionInfo.Password = strPassword
- LogInfo.ConnectionInfo.DatabaseName = strDatabase
- Catch ex As Exception
- MessageBox.Show(ex.Message)
- End Try
- End Sub
- Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Dim objReport As New SummaryRpt
- Dim DT As New DataTable
- 'Dim CmdStr As String
- Dim sqlConnection1 As New SqlConnection
- 'Dim sqlDataAdapter1
- Dim sqlSelectCommand1 As New SqlCommand
- strDatabase = "Location 1"
- SetLogonInfo()
- 'sqlConnection1.ConnectionString = "Data Source=" & strDataSource & ";USER ID=" & strUserId & ";pwd=" & strPassword & ";Initial Catalog=" & strDatabase
- 'Try
- ' CmdStr = "Select * From SummaryReports"
- ' sqlConnection1.Open()
- ' sqlDataAdapter1 = New SqlDataAdapter(CmdStr, sqlConnection1)
- ' DT.Clear()
- ' sqlDataAdapter1.Fill(DT)
- ' sqlConnection1.Close()
- 'Catch ex As Exception
- ' MessageBox.Show(ex.Message)
- 'End Try
- 'objReport.Database.Tables(0).SetDataSource(DT)
- CrystalReportViewer1.ReportSource = objReport
- End Sub