Click here to Skip to main content
15,616,147 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am a SQL newbie. I have been working with Visual Studio 2015 preview. It allows me to create a project that uses a SQL database. I have a table:

CREATE TABLE [dbo].[ElementTable] (
    [AtomNum]        TINYINT         DEFAULT ((1)) NOT NULL,
    [AtomSymb]       NCHAR (3)       NOT NULL,
    [AtomName]       NCHAR (15)      NOT NULL,
    [AtomRadius]     DECIMAL (18, 5) NULL,
    [AtomWeight]     DECIMAL (18, 5) NULL,
    [AtomBoilPt]     DECIMAL (18, 5) NULL,
    [AtomMeltPt]     DECIMAL (18, 5) NULL,
    [AtomDensity]    DECIMAL (18, 5) NULL,
    [AtomState]      NCHAR (10)      NULL,
    [AtomOxyState1]  SMALLINT        NULL,
    [AtomIonRadius1] DECIMAL (18, 5) NULL,
    [AtomOxyState2]  SMALLINT        NULL,
    [AtomIonRadius2] DECIMAL (18, 5) NULL,
    [AtomOxyState3]  SMALLINT        NULL,
    [AtomIonRadius3] DECIMAL (18, 5) NULL,
    [AtomOxyState4]  SMALLINT        NULL,
    [AtomIonRadius4] DECIMAL (18, 5) NULL,
    [AtomOxyState5]  SMALLINT        NULL,
    [AtomIonRadius5] DECIMAL (18, 5) NULL,
    [AtomOxyState6]  SMALLINT        NULL,
    [AtomIonRadius6] DECIMAL (18, 5) NULL,

And I have a view:

CREATE VIEW [dbo].[AtomicDataView]
	AS SELECT * FROM [ElementTable]

If I am looking at the SQL Server Object Viewer Tab, and right-click on the dbo.AtomicDataView that is in my Atomic database, I get list of things I can do like a 'Data Comparison' between different views on the same table, like all of the columns or only certain columns, and then between different databases, one original one replicated, and the can update the target. I also can 'Rename', 'Delete', 'Script As', 'View Code' (which just shows a couple of lines seen above), 'View Permissions', and 'View Data' which allowed to enter the data in the table. While under my 'Projects' listing just below the servers, I see a duplicate directory structure, yet when I right-click on the dbo.AtomicDataView list item, I don't get the 'View Data' option.

When I compile my project, I get 2 files, one is a DLL, the other is a DACPAC file. I am used to C++ headers and Source files for pragmatic use of variables and functions. I am not sure what files I can add that will be able to work with the data in the static table of 110 rows, meaning data won't change in the columns, nor will any more rows be added, and essentially will be a read-only table. I presume that my Atomic.mdf is where it is all stored.

I want to write various 'get's, maybe one for each data column, but lets say I want to:

SELECT AtomRadius FROM dbo.ElementTable WHERE AtomNum = x;

And I want to programmatically supply 'x', and use the resulting data, so
where would I put that kind of statement? Could I put more than one statement in a SQLQuery? How would I use or access an MFC class from inside this DLL, and what file types do I use, and how do I include them, and then use them from an outside EXE that wants to import data from the DLL?

Then If I manage to SELECT it, how do I get it into a variable to compute a surface area or volume?
Updated 17-Mar-15 17:58pm
ZurdoDev 17-Mar-15 8:00am    
I see you ask a lot of questions but I really don't see where you are stuck.
Maciej Los 17-Mar-15 9:11am    
Short and to the point!
The_Inventor 17-Mar-15 23:55pm    
So, Maciej, here you are making comment, without any compassion for the question, "How does one pragmatically retrieve the info from the built SQL DLL that presumably has the table data contained within it?" Do you have anything of real value to offer relating to SQL or DLL's using C++ to do it?
Mehdi Gholam 18-Mar-15 0:32am    
DLL's do not have SQL tables within them, SQL is a language, database engines have interfaces so you can connect and query.
ZurdoDev 18-Mar-15 7:33am    
As already mentioned, DLLs do not have data within them. A dll exposes methods and functions for you to call that can then access the data.

We're trying to help you so don't be rude about it. You really haven't asked a clear question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900