I'm building a local database with VS.Net, using C#. I have constructed the database and filled it with data. I've already been through the process of connecting to the \bin copy of the Db and setting the file to "Do Not Copy". Now, I want to design Views in the Database Connection. I've designed a view and the Sql string validated OK. But, when I execute sql, no data shows in the table, either at design time or runtime. Have I neglected something?

6 Years
Discussion Span
Last Post by ggbard

I didn't built the view with code. I used the Data Connection tree, expanded the database node, right clicked on the view node and selected "Add New View". I designed the view in the design window. The Execute Sql command did not generate any data in the view table even though the main table has data. Here is the sql code that it generated.

SELECT     TOP (100) PERCENT dbo.Class.ClassID AS [ ID], dbo.Class.ClassName AS Class, dbo.Class.Area, dbo.Class.Subarea, dbo.Class.Subject, 
                      dbo.Cases.CaseName AS [Case Name], dbo.Cases.Facts, dbo.Cases.ProceduralHistory AS [Procedural History], dbo.Cases.ProceduralIssues, 
                      dbo.Cases.SubstantiveIssues, dbo.Cases.Holding, dbo.Cases.Ruling, dbo.Rules.BodyOfLaw AS [Body of Law], dbo.Rules.Section, 
                      dbo.Rules.RuleName AS [Rule Name], dbo.Rules.[Rule], dbo.Cases.AdditionalRules AS [Additional Rules], dbo.Cases.Reasoning, 
                      dbo.Cases.ConcurrringOpinion AS [Concurring Opinion], dbo.Cases.DissentingOpinion AS [Dissenting Opinion], dbo.Cases.Dicta, dbo.Cases.Notes, 
                      dbo.Cases.OutlineNotes AS [Outline Notes], dbo.Cases.Vocab 
FROM         dbo.Cases INNER JOIN 
                      dbo.Class ON dbo.Cases.ClassID = dbo.Class.ClassID INNER JOIN 
                      dbo.Rules ON dbo.Cases.RuleID = dbo.Rules.RuleID 
WHERE     (dbo.Cases.CaseName = '1Gary Bard') 

That's what I needed. I was using SQL SERVER syntax. I fixed it and it works fine now. Thanks for the help.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.