i have custom code that queries a table and retuns a value. code below which is working.
My question: is it possible to reference the shared Data Source somehow as my query accesses the same data base as the report?
Public Function GetReportingWindow() As String
Dim strConnection as String = "Data Source=x.x.x.x;Initial Catalog=ip360Dashboard;User Id=********;Password=******;"
Dim window as String
Using conn As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(strConnection)
Dim cmd As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand("SELECT numberOfReportingDays from [$_sivms_config] where id=1", conn)
conn.Open()
Dim dr As System.Data.SqlClient.SqlDataReader = cmd.ExecuteReader()
If dr.HasRows Then
While dr.Read()
window = dr(0).ToString()
End While
Else
window = "??"
End If
dr.Close()
conn.Close()
End Using
return window
End Function