For a little idea of what I am trying to do with this. Is there anyway I can get the below code to be read by crystal reports. I need UserName to be dynamic and change with each user opening the report? (the bolded parts I just can't get to work with crystal)
Dim objDataSet As New DataSet()
Dim objDataAdapter As SqlClient.SqlDataAdapter
Dim UserName As String = User.Identity.Name
objConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("CsiConnectionString").ConnectionString)
If User.IsInRole("consultant") Then
objDataAdapter = New SqlDataAdapter("SELECT tblTireJobs.JobID, tblTireJobs.Status, tblTireJobs.FirstName, tblTireJobs.LastName, tblTireJobs.DateReported, tblTireShop.TireKingdomID, tblTireShop.Name " & _
"FROM tblTireJobs INNER JOIN tblTireShop ON tblTireJobs.ShopID = tblTireShop.ShopID WHERE tblTireShop.FBCID='" & UserName & "' ORDER BY tblTireShop.Name", objConnection)
Else
objDataAdapter = New SqlDataAdapter("SELECT tblTireJobs.JobID, tblTireJobs.Status, tblTireJobs.FirstName, tblTireJobs.LastName, tblTireJobs.DateReported, tblTireShop.TireKingdomID, tblTireShop.Name " & _
"FROM tblTireJobs INNER JOIN tblTireShop ON tblTireJobs.ShopID = tblTireShop.ShopID ORDER BY tblTireShop.Name", objConnection)
End If
objDataSet = New DataSet()
objDataAdapter.Fill(objDataSet)