Unsaved Changes

Feb 14, 2008

i used following code to create atable on ssce 3.5 database, but there is something wrong and i dont know what? the problem is all the results is S_OK but ssce does not create the table on the database, the interesting point is, if i connect the same database with vs2008 server explorer and execute the code, ssce succesfully creates the table, my mind is totally screwed up...

[CODE]
wstring cmd;//contains create table command;
HRESULT hr = NOERROR;
DBPROPSET dbpropset[2];
DBPROP dbprop[1];
DBPROP sscedbprop[1];

IDBInitialize * pIDBInitialize = NULL;
IDBProperties * pIDBProperties = NULL;
IDBCreateSession *m_pIDBCreateSession;
IDBCreateCommand *pIDBCrtCmd = NULL;
ICommandText *pICmdText = NULL;

hr = CoCreateInstance(CLSID_SQLSERVERCE, 0, CLSCTX_INPROC_SERVER,
IID_IDBInitialize, (void**) &pIDBInitialize);

VariantInit(&dbprop[0].vValue);
VariantInit(&sscedbprop[0].vValue);

dbprop[0].dwPropertyID = DBPROP_INIT_DATASOURCE;
dbprop[0].dwOptions = DBPROPOPTIONS_REQUIRED;
dbprop[0].vValue.vt = VT_BSTR;
dbprop[0].vValue.bstrVal = SysAllocString(L"NewDatabase.sdf");

sscedbprop[0].dwPropertyID = DBPROP_SSCE_DBPASSWORD;
sscedbprop[0].dwOptions = DBPROPOPTIONS_REQUIRED;
sscedbprop[0].vValue.vt = VT_BSTR;
sscedbprop[0].vValue.bstrVal = SysAllocString(L"<enterStrongPasswordHere>");

dbpropset[0].guidPropertySet = DBPROPSET_DBINIT;
dbpropset[0].rgProperties = dbprop;
dbpropset[0].cProperties = sizeof(dbprop)/sizeof(dbprop[0]);

dbpropset[1].guidPropertySet = DBPROPSET_SSCE_DBINIT;
dbpropset[1].rgProperties = sscedbprop;
dbpropset[1].cProperties = sizeof(sscedbprop)/sizeof(sscedbprop[0]);

pIDBInitialize->QueryInterface(IID_IDBProperties,(void**)&pIDBProperties);
hr = pIDBProperties->SetProperties(sizeof(dbpropset)/sizeof(dbpropset[0]),dbpropset);
hr = pIDBInitialize->Initialize();
hr = pIDBInitialize->QueryInterface(IID_IDBCreateSession, (void**)&m_pIDBCreateSession);
hr = m_pIDBCreateSession->CreateSession(NULL, IID_IDBCreateCommand, (IUnknown**) &pIDBCrtCmd);
hr = pIDBCrtCmd->CreateCommand(NULL, IID_ICommandText, (IUnknown**) &pICmdText);
hr = pICmdText->SetCommandText(DBGUID_DBSQL, cmd.c_str());
hr = pICmdText->Execute(NULL, IID_NULL, NULL, NULL, NULL);

Exit:
pICmdText->Release();
pIDBProperties->Release();
pIDBInitialize->Release();
VariantClear(&dbprop[0].vValue);
VariantClear(&sscedbprop[0].vValue);

[/CODE]

View 4 Replies


ADVERTISEMENT

Storing Unsaved Word Documents As BLOBs

Jul 20, 2005

Hi folks,I want to be able to store and retrieve UNSAVED Word documents as BLOBs. Igot all the info for storing them if they're already saved on the filesystem. But what if they're not already saved? I could save them to a tempfile first and then make it a blob, but I'd rather not put them on the filesystem at all. I could use Document.Contents to get the Range object for thewhole doc and then BLOB that, but I'm not sure that would be quite the sameas a .doc file, maybe things like Styles and the like would be missing.TIA!Dave

View 2 Replies View Related

SQL 2012 :: SSMS Auto-recovery / Auto-save New (unsaved) Queries

Feb 16, 2014

Since upgrading from SQL Server Management Studio 2008 R2, I've noticed that it no longer autosaves queries that have not been manually saved first. If a file has been manually saved the autorecover files end up in the following directory:

%appdata%MicrosoftSQL Server Management Studio11.0AutoRecoverDatSolution1

However, I have ended up in the situation where I have unsaved queries when my computer has crashed and have not been able to recover them.

I have also found references to .sql files stored in temp files in the following directory, but the files here seem to be very haphazardly caught:

%userprofile%AppDataLocalTemp

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved