Click here to Skip to main content
15,921,841 members
Home / Discussions / Database
   

Database

 
GeneralTimeout expired. Pin
meaya22-Jun-03 21:34
meaya22-Jun-03 21:34 
Generalslow ODBC connections with Win 2000 Server Pin
jpeg22-Jun-03 21:25
jpeg22-Jun-03 21:25 
GeneralRe: slow ODBC connections with Win 2000 Server Pin
basementman23-Jun-03 4:09
basementman23-Jun-03 4:09 
GeneralRe: slow ODBC connections with Win 2000 Server Pin
jpeg23-Jun-03 20:54
jpeg23-Jun-03 20:54 
GeneralRe: slow ODBC connections with Win 2000 Server Pin
basementman24-Jun-03 5:09
basementman24-Jun-03 5:09 
GeneralExiting loop before it finishes causes program to crash.. Pin
IrishSonic22-Jun-03 6:43
IrishSonic22-Jun-03 6:43 
GeneralRe: Exiting loop before it finishes causes program to crash.. Pin
Nick Parker22-Jun-03 6:54
protectorNick Parker22-Jun-03 6:54 
GeneralRe: Exiting loop before it finishes causes program to crash.. Pin
IrishSonic23-Jun-03 11:24
IrishSonic23-Jun-03 11:24 
Hiya the code here is called each time to write the strings into the db. A file is read in each time it finds the right into to load, it calls this function:


int CPxhsinvDlg::LoadSQLDB(char* Invoice, char* LoadString)
{
int SQLStringSize=0;
int SQLStringSize1=0;
int SQLStringSize2=0;
CString sqlcmd;

try
{
// get the size of the string
SQLStringSize = strlen( LoadString );

// if the string is >= 7950
if( SQLStringSize >= MAX_LINE_SIZE )
{
char Line1[MAX_LINE_SIZE];
char Line2[MAX_LINE_SIZE];

// copy strings to new strings
strncpy( Line1,LoadString,MAX_LINE_SIZE );
strncpy( Line2,LoadString + MAX_LINE_SIZE,MAX_LINE_SIZE );

// get the size of string 1
SQLStringSize1 = strlen( Line1 );
SQLStringSize2 = strlen( Line2 );

// format the sql string
sqlcmd.Format("INSERT INTO PXHSINV (Invoice,Invoice_Code)"
"VALUES('Pt 1%s','Pt1 %*.*s')",
Invoice,
SQLStringSize1,
SQLStringSize1,
Line1);

// execute the sql string
pConnection->Execute(_bstr_t(sqlcmd), RecordsAffected, 1);

// empty string
sqlcmd.Empty();

// format the sql string
sqlcmd.Format("INSERT INTO PXHSINV (Invoice,Invoice_Code)"
"VALUES('Pt2 %s','Pt2 %*.*s')",
Invoice,
SQLStringSize2,
SQLStringSize2,
Line2);

// execute the sql string
pConnection->Execute(_bstr_t(sqlcmd), RecordsAffected, 1);

// empty string
sqlcmd.Empty();
}
else
{
// format the sql string
sqlcmd.Format("INSERT INTO PXHSINV (Invoice,Invoice_Code)"
"VALUES('%s','%*.*s')",
Invoice,
SQLStringSize,
SQLStringSize,
LoadString);

// execute the sql string
pConnection->Execute(_bstr_t(sqlcmd), RecordsAffected, 1);

// empty string
sqlcmd.Empty();
}
}
catch(_com_error &e)
{
_bstr_t bstrSource(e.Source());
_bstr_t bs = _bstr_t(" Error: ") + _bstr_t(e.Error()) + _bstr_t(" Msg: ")
+ _bstr_t(e.ErrorMessage()) + _bstr_t(" Description: ")
+ _bstr_t(e.Description());

MessageBox(bs,bstrSource, MB_OK);
}
return 0;
}

Is the problem of the program crashing on a screen saver common?? As I say it only crashes when I try to exit the during the loop or the screen saver kicks in.
How can I fix this??

Thanks.
GeneralStoring Class(Object) in a SQL Database (C#) Pin
Daniel Kirstenpfad21-Jun-03 3:54
Daniel Kirstenpfad21-Jun-03 3:54 
Questionhow to generalize SQL queries Pin
puppiesLover20-Jun-03 8:04
puppiesLover20-Jun-03 8:04 
AnswerRe: how to generalize SQL queries Pin
Mike Osbahr23-Jun-03 4:48
Mike Osbahr23-Jun-03 4:48 
GeneralAdd host to MySQL 4 Pin
Matt Newman19-Jun-03 7:16
Matt Newman19-Jun-03 7:16 
GeneralRe: Add host to MySQL 4 Pin
ZoogieZork22-Jun-03 7:19
ZoogieZork22-Jun-03 7:19 
GeneralPopulate schema to database Pin
Jim Stewart19-Jun-03 6:59
Jim Stewart19-Jun-03 6:59 
GeneralCreateDatabase Pin
Jim Stewart19-Jun-03 6:50
Jim Stewart19-Jun-03 6:50 
GeneralRe: CreateDatabase Pin
Joshua Nussbaum27-Jun-03 8:51
Joshua Nussbaum27-Jun-03 8:51 
GeneralTransactions Pin
Megan Forbes19-Jun-03 5:03
Megan Forbes19-Jun-03 5:03 
GeneralRe: Transactions Pin
basementman19-Jun-03 8:44
basementman19-Jun-03 8:44 
GeneralRe: Transactions Pin
Megan Forbes19-Jun-03 22:18
Megan Forbes19-Jun-03 22:18 
GeneralRe: Transactions Pin
Arjan Einbu19-Jun-03 12:14
Arjan Einbu19-Jun-03 12:14 
GeneralRe: Transactions Pin
Megan Forbes19-Jun-03 22:19
Megan Forbes19-Jun-03 22:19 
GeneralRe: Transactions Pin
Arjan Einbu19-Jun-03 22:30
Arjan Einbu19-Jun-03 22:30 
GeneralRe: Transactions Pin
basementman20-Jun-03 3:58
basementman20-Jun-03 3:58 
GeneralRe: Transactions Pin
Arjan Einbu20-Jun-03 11:53
Arjan Einbu20-Jun-03 11:53 
GeneralNotesSQL using.NET, OdbcException Pin
sinus-c18-Jun-03 0:35
susssinus-c18-Jun-03 0:35 

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.