|
-
September 4th, 2001, 07:11 PM
#2
Re: c++ and Oracle connectivity
TESTHR(pConn.CreateInstance(__uuidof(Connection)));
TESTHR(pRS.CreateInstance(__uuidof(Recordset)));
try
{
pConn->Open("Provider=sqloledb;Data Source=Sydney;"
"Initial Catalog=radio;User Id=sa;Password=f1ng3rs;","","",adConnectUnspecified);
pRS->PutRefActiveConnection(pConn);
pRS->Open("SELECT artistname, albumname, songname, fileLocationASF, fileLocationRA, songID FROM song WHERE uploadedToISP=0 ORDER BY songID DESC;",
vtMissing, adOpenForwardOnly, adLockReadOnly, adCmdText);
while (!pRS->adoEOF)
{
vtArtist = pRS->Fields->GetItem((long)0)->GetValue();
vtAlbum = pRS->Fields->GetItem((long)1)->GetValue();
vtSong = pRS->Fields->GetItem((long)2)->GetValue();
vtFileLocationASF = pRS->Fields->GetItem((long)3)->GetValue();
vtFileLocationRA = pRS->Fields->GetItem((long)4)->GetValue();
vtSongID = pRS->Fields->GetItem((long)5)->GetValue();
strBuff.Format("%s - %s - %s", (char*)((_bstr_t)vtArtist), (char*)((_bstr_t)vtAlbum), (char*)((_bstr_t)vtSong));
BSTR bstrFilename = strBuff.AllocSysString();
if (ftpUploadFile(bstrFilename, m_strFTPServername, (char*)((_bstr_t)vtFileLocationASF), (char*)((_bstr_t)vtFileLocationRA), m_strFTPASFRoot, m_strFTPRARoot))
{
strBuff.Format("radioUpdateUploadedToISP %li", vtSongID.lVal);
//AfxMessageBox(strSQL);
BSTR bstrSQL = strBuff.AllocSysString();
pConn->Execute(bstrSQL, NULL, adExecuteNoRecords);
SysFreeString(bstrSQL);
pRS->MoveNext();
}
SysFreeString(bstrFilename);
}
pRS->Close();
pConn->Close();
}
catch (_com_error)
{
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|