Click here to Skip to main content
15,910,787 members
Home / Discussions / Database
   

Database

 
QuestionUse Page Locks when Accessing the Index Pin
Brendan Vogt25-May-08 1:57
Brendan Vogt25-May-08 1:57 
Questionsubstring from smalldatetime Pin
Mr.Kode25-May-08 0:50
Mr.Kode25-May-08 0:50 
AnswerRe: substring from smalldatetime Pin
Colin Angus Mackay25-May-08 5:16
Colin Angus Mackay25-May-08 5:16 
QuestionSQL Server Database Access Pin
hariram2825-May-08 0:35
hariram2825-May-08 0:35 
AnswerRe: SQL Server Database Access Pin
Colin Angus Mackay25-May-08 5:19
Colin Angus Mackay25-May-08 5:19 
GeneralRe: SQL Server Database Access Pin
hariram2826-May-08 2:15
hariram2826-May-08 2:15 
GeneralRe: SQL Server Database Access Pin
Colin Angus Mackay26-May-08 4:13
Colin Angus Mackay26-May-08 4:13 
QuestionODBC ms access insertion problem via mfc Pin
elegantcharm24-May-08 9:06
elegantcharm24-May-08 9:06 
hi,
This is code i am using I've picked it from some where and I've changed it according to my requirements but its not inserting a new record. it gives error like attempt failed or record set is read only. I don't know i am using dynaset as an opening mode but still i get the error. kindly any one knows where i am going wrong.


CDatabase *mydb=new CDatabase;
ASSERT(mydb);
mydb->OpenEx("DSN=ff");

if(!mydb->IsOpen())
{

MessageBox("Unable to connect to Database. Please\ncontact your server administrator.", "Database Error", MB_ICONEXCLAMATION);
return;
}
CRecordset*myrec=new CRecordset(mydb);
ASSERT(myrec);
myrec->Open(CRecordset::dynaset,_T("SELECT s,p FROM e"),CRecordset::noDirtyFieldCheck);


if(!myrec->CanUpdate())
{
MessageBox("Database reports unable to update.", "Database Error", MB_ICONEXCLAMATION);
myrec->Close();
return;
}

if(!set.Open(CRecordset::dynaset,"SELECT * From e",CRecordset::noDirtyFieldCheck))
{
MessageBox("Unable to open database record. (SELECT * e)", "Database Error", MB_ICONEXCLAMATION);
set.Close();
return;
}
/*if (!set.CanAppend())
{
MessageBox("Database does not support adding records. Please\ncontact your server administrator.", "Database Error", MB_ICONEXCLAMATION);
set.Close();

}*/
set.MoveFirst();
while( !set.IsEOF() )
{
set.MoveNext();
}
int lRecCnt = set.GetRecordCount();
int newID=lRecCnt+2;

m_g=lRecCnt;
UpdateData(FALSE);


// Prepare for a new record addition.
try
{
set.MoveLast();
set.AddNew();
set.m_s = "Becky Dugan";
set.m_p = "Becky Dugan";

set.Requery();
set.SetFieldDirty(NULL);
set.Update();


}
catch(CException* pE)
{

char buf[256];
pE->GetErrorMessage(buf, 256, NULL);
AfxMessageBox(buf);
pE->Delete();
}

// Close Recordset
set.Close();
// Close Database
mydb->Close();
AnswerRe: ODBC ms access insertion problem via mfc Pin
Vaclav_25-May-08 7:54
Vaclav_25-May-08 7:54 
GeneralRe: ODBC ms access insertion problem via mfc Pin
elegantcharm27-May-08 9:21
elegantcharm27-May-08 9:21 
QuestionAn error has occurred while establishing a connection to the server. When connecting to SQL Server 2005 Pin
mr.mohsen23-May-08 21:17
mr.mohsen23-May-08 21:17 
QuestionSystem perfomance get down when i runthe local report through reporting services Pin
bhushi998123-May-08 20:20
bhushi998123-May-08 20:20 
QuestionSQL query Pin
Kartik Rathi23-May-08 20:11
Kartik Rathi23-May-08 20:11 
AnswerRe: SQL query Pin
Mycroft Holmes24-May-08 23:54
professionalMycroft Holmes24-May-08 23:54 
QuestionWhats wrong in sql2005 Pin
AlexeiXX323-May-08 20:01
AlexeiXX323-May-08 20:01 
AnswerRe: Whats wrong in sql2005 Pin
Mycroft Holmes25-May-08 0:00
professionalMycroft Holmes25-May-08 0:00 
GeneralRe: Whats wrong in sql2005 Pin
AlexeiXX325-May-08 12:13
AlexeiXX325-May-08 12:13 
GeneralRe: Whats wrong in sql2005 Pin
AlexeiXX326-May-08 8:43
AlexeiXX326-May-08 8:43 
GeneralRe: Whats wrong in sql2005 Pin
Mycroft Holmes26-May-08 12:27
professionalMycroft Holmes26-May-08 12:27 
GeneralRe: Whats wrong in sql2005 Pin
AlexeiXX326-May-08 12:43
AlexeiXX326-May-08 12:43 
GeneralRe: Whats wrong in sql2005 Pin
Mycroft Holmes26-May-08 13:54
professionalMycroft Holmes26-May-08 13:54 
QuestionAny way to attach a timestamp/rowversion column only to selected columns? Pin
supercat923-May-08 14:24
supercat923-May-08 14:24 
QuestionFind Instances Pin
mehrdadc4823-May-08 10:42
mehrdadc4823-May-08 10:42 
AnswerRe: Find Instances Pin
Alsvha23-May-08 21:01
Alsvha23-May-08 21:01 
AnswerRe: Find Instances Pin
mr.mohsen23-May-08 21:22
mr.mohsen23-May-08 21:22 

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.