Click here to Skip to main content
15,888,351 members
Home / Discussions / Database
   

Database

 
QuestionSet value of Excel cell to the result of a query [modified] Pin
anthasaurus25-Aug-10 23:12
anthasaurus25-Aug-10 23:12 
AnswerRe: Set value of Excel cell to the result of a query Pin
Eddy Vluggen26-Aug-10 7:20
professionalEddy Vluggen26-Aug-10 7:20 
QuestionBest way to merge/process commands on SQLCE Pin
Spawn@Melmac25-Aug-10 5:23
Spawn@Melmac25-Aug-10 5:23 
AnswerRe: Best way to merge/process commands on SQLCE Pin
David Mujica25-Aug-10 5:39
David Mujica25-Aug-10 5:39 
AnswerRe: Best way to merge/process commands on SQLCE Pin
Eddy Vluggen25-Aug-10 7:54
professionalEddy Vluggen25-Aug-10 7:54 
GeneralRe: Best way to merge/process commands on SQLCE Pin
Spawn@Melmac25-Aug-10 14:22
Spawn@Melmac25-Aug-10 14:22 
GeneralRe: Best way to merge/process commands on SQLCE Pin
Eddy Vluggen26-Aug-10 7:19
professionalEddy Vluggen26-Aug-10 7:19 
GeneralRe: Best way to merge/process commands on SQLCE Pin
Spawn@Melmac26-Aug-10 11:08
Spawn@Melmac26-Aug-10 11:08 
Ok here you go but I should warn you I don't fully understand it myself.

I think of an accessor as a wrapper to the SQL like this (which is an extract from working code)...

class CDBHubDetails
{
public:
// Data Elements
	TCHAR	f_LocSub[255];
	int		f_HubID;						// Input field

// Column binding map
BEGIN_COLUMN_MAP(CDBHubDetails)
   COLUMN_ENTRY(1, f_LocSub)
END_COLUMN_MAP()

// Parameter binding map
BEGIN_PARAM_MAP(CDBHubDetails)
   SET_PARAM_TYPE(DBPARAMIO_INPUT)
   COLUMN_ENTRY(1, f_HubID)
END_PARAM_MAP()

DEFINE_COMMAND_EX(CDBHubDetails, L" \
     SELECT  Hub.SubLoc \
     FROM    Location  \
     WHERE   Hub.id = ?")
};


Now this get's used as follows

CCommand<CAccessor<CDBHubDetails > > rs;

rs.f_HubID = pHub->m_iHubID;                                                 // pull the HubID from the CDevice object
hr = rs.Open(m_oDB->session);


where I can then walk the recordset.

The thing is I have not figured out how to process the additional SELECT command I need to include in the INSERT operation so I can retrieve the ID of the item inserted.

Now I know I am being both optemistic, and lazy, but I was hoping that as the INSERT does not return a recordset itself, the SELECT @@IDENTITY would become the result. Silly me...

The responses thus far have given me some ideas but finding examples I can learn from is proving difficult. MSDN seems devoid of C++ examples in the documentation (although F# is there!).

Thank you for taking the time to look at this for me.
Alan

GeneralRe: Best way to merge/process commands on SQLCE Pin
Eddy Vluggen27-Aug-10 7:04
professionalEddy Vluggen27-Aug-10 7:04 
QuestionODP.Net Vs OleDb Pin
V.25-Aug-10 3:51
professionalV.25-Aug-10 3:51 
AnswerRe: ODP.Net Vs OleDb Pin
dan!sh 25-Aug-10 5:31
professional dan!sh 25-Aug-10 5:31 
GeneralRe: ODP.Net Vs OleDb Pin
V.25-Aug-10 8:07
professionalV.25-Aug-10 8:07 
GeneralRe: ODP.Net Vs OleDb Pin
dan!sh 25-Aug-10 22:11
professional dan!sh 25-Aug-10 22:11 
QuestionIn-memory Pin
FEMDEV25-Aug-10 0:05
FEMDEV25-Aug-10 0:05 
AnswerRe: In-memory Pin
Eddy Vluggen25-Aug-10 10:19
professionalEddy Vluggen25-Aug-10 10:19 
QuestionUpdate where count > 1 Pin
Lash2024-Aug-10 7:25
Lash2024-Aug-10 7:25 
AnswerRe: Update where count > 1 Pin
Blue_Boy24-Aug-10 8:06
Blue_Boy24-Aug-10 8:06 
AnswerRe: Update where count > 1 Pin
Luc Pattyn24-Aug-10 8:06
sitebuilderLuc Pattyn24-Aug-10 8:06 
AnswerRe: Update where count > 1 Pin
David Mujica24-Aug-10 8:06
David Mujica24-Aug-10 8:06 
GeneralRe: Update where count > 1 Pin
Lash2024-Aug-10 8:35
Lash2024-Aug-10 8:35 
GeneralRe: Update where count > 1 Pin
Blue_Boy24-Aug-10 8:59
Blue_Boy24-Aug-10 8:59 
QuestionSplit a varbinary in a SELECT Pin
solomon8524-Aug-10 2:01
solomon8524-Aug-10 2:01 
AnswerRe: Split a varbinary in a SELECT Pin
Blue_Boy24-Aug-10 2:47
Blue_Boy24-Aug-10 2:47 
GeneralRe: Split a varbinary in a SELECT Pin
R. Giskard Reventlov24-Aug-10 3:25
R. Giskard Reventlov24-Aug-10 3:25 
Questiondelete all procedures from my database Pin
Zeyad Jalil23-Aug-10 23:39
professionalZeyad Jalil23-Aug-10 23:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.