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?

Recommended Answers

All 4 Replies

A query can validate and still have a result with no rows.
Please show your code sample.

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') 
ORDER BY [ ID]

This query is not syntactically correct in MySQL. How do you validate it?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.