Click here to Skip to main content
15,895,256 members
Home / Discussions / Database
   

Database

 
GeneralRe: Olap Cubes Pin
Anonymous18-Feb-05 5:40
Anonymous18-Feb-05 5:40 
GeneralRe: Olap Cubes Pin
GWSyZyGy18-Feb-05 7:21
GWSyZyGy18-Feb-05 7:21 
GeneralRe: Olap Cubes Pin
Yulianto.18-Feb-05 15:09
Yulianto.18-Feb-05 15:09 
GeneralInserting and Selecting .wav files from and to MySQL table Pin
j1webb17-Feb-05 11:01
j1webb17-Feb-05 11:01 
GeneralRe: Inserting and Selecting .wav files from and to MySQL table Pin
j45mw19-Feb-05 4:14
j45mw19-Feb-05 4:14 
GeneralNeed to convert the content of one field into several from a view Pin
DEWright_CA17-Feb-05 9:33
DEWright_CA17-Feb-05 9:33 
GeneralRe: Need to convert the content of one field into several from a view Pin
numbrel18-Feb-05 12:46
numbrel18-Feb-05 12:46 
Generalcannot add new records with multiple fields Pin
elephantstar17-Feb-05 8:31
elephantstar17-Feb-05 8:31 
Hi there,

I'm not sure why following code does not work for one class function but does for another in my application. It doesn't allow me to insert into a table that contains more than one field. Below, the field and value arrays are char array pointers (char *fields[200], values[200]) that contain the field names and their corresponding values. num_fields is the number of fields in the table.

HRESULT hr;

m_Rec.CreateInstance( __uuidof(ADODB::Recordset));
hr = m_Rec->("SELECT * FROM Employees", _variant_t(IDispatch *)m_Conn, true), ADODB::adOpenForwardOnly, ADODB::adLockOptimistic, ADODB::adCmdText);
if (SUCCEEDED(hr))
{
COleSafeArray vaFieldList;
vaFieldList.CreateOneDim(VT_VARIANT, num_fields);

COleSafeArray vaValueArray;
vaValueArray.CreateOneDim(VT_VARIANT, num_fields);

long lArrayIndex[1];
for (i = 0; i < num_fields; i++)
{
lArrayIndex[0] = i;
vaFieldList.PutElement(lArrayIndex, &(_variant_t(fields[i])));
vaValueArray.PutElement(lArrayIndex, &(_variant_t(values[i])));
}
m_Rec->AddNew(vaFieldList, vaValueArray);
m_Rec->Close();
}

//clear the array for the next record
for (i = 0; i < num_fields; i++)
{
*(fields + i) = 0;
*(values + i) = 0;
}

Thanks!
GeneralRe: cannot add new records with multiple fields Pin
elephantstar17-Feb-05 10:14
elephantstar17-Feb-05 10:14 
GeneralCompare datarows Pin
pedros7316-Feb-05 10:02
pedros7316-Feb-05 10:02 
GeneralRe: Compare datarows Pin
Just Greeky Creek16-Feb-05 21:19
Just Greeky Creek16-Feb-05 21:19 
GeneralRe: Compare datarows Pin
pedros7316-Feb-05 22:47
pedros7316-Feb-05 22:47 
GeneralRe: Compare datarows Pin
Just Greeky Creek16-Feb-05 22:56
Just Greeky Creek16-Feb-05 22:56 
GeneralDelete question Pin
Tom Wright16-Feb-05 8:57
Tom Wright16-Feb-05 8:57 
GeneralRe: Delete question Pin
Mike Dimmick17-Feb-05 1:25
Mike Dimmick17-Feb-05 1:25 
GeneralRe: Delete question Pin
Tom Wright17-Feb-05 4:22
Tom Wright17-Feb-05 4:22 
GeneralRe: Delete question Pin
Rob Graham17-Feb-05 7:39
Rob Graham17-Feb-05 7:39 
GeneralDataGrid Columns Pin
numbrel16-Feb-05 5:40
numbrel16-Feb-05 5:40 
GeneralRe: DataGrid Columns Pin
Just Greeky Creek16-Feb-05 21:15
Just Greeky Creek16-Feb-05 21:15 
GeneralRe: DataGrid Columns Pin
numbrel17-Feb-05 3:06
numbrel17-Feb-05 3:06 
GeneralSQL Guru challenge :) Or just a simple query question Pin
Richard Parsons16-Feb-05 3:07
Richard Parsons16-Feb-05 3:07 
GeneralRe: SQL Guru challenge :) Or just a simple query question Pin
Michael Potter16-Feb-05 3:24
Michael Potter16-Feb-05 3:24 
GeneralRe: SQL Guru challenge :) Or just a simple query question Pin
Richard Parsons16-Feb-05 6:50
Richard Parsons16-Feb-05 6:50 
GeneralTest data script Pin
Richard Parsons16-Feb-05 6:51
Richard Parsons16-Feb-05 6:51 
GeneralEDIT: SQL Guru challenge :) Or just a simple query question Pin
Richard Parsons16-Feb-05 7:27
Richard Parsons16-Feb-05 7:27 

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.