LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel Driver Error: Cannot Expand Named Range

Dear All,

I have created a user data storage with Excel
where I am doing insertions only.
Sometimes the insertions are done as expected
but sometimes they failed and I get the error message
from Excel: "Cannot expand named range".
I have found a couple of messages about this error
but none of them suggested a solution.
I include the code I am using at the end of this message.
Would anyone have an idea about why Excel manages sometimes
to include my data and sometimes not?
Could it come from the nature of my data?
Let me know if you need more details about my code.

I would really appreciate any help

Helene.

================================================== ==============================
Code for insertion:

char SQLquery[250];
strcpy(SQLquery,
"INSERT INTO ResultTable (Name, File, RunwayNum, TotalTime,
CplexTime, SideCplexTime, SolNum, InsertedChildNum, ImprovedChildNum,
GeneratedChildNum, Fitness, Unfitness) VALUES (\'");
strcat(SQLquery,str1);
strcat(SQLquery,"\',\'");
strcat(SQLquery,str2);
strcat(SQLquery,"\',\'");
strcat(SQLquery,str3);
strcat(SQLquery,"\',");
strcat(SQLquery,strval1);
strcat(SQLquery,",");
strcat(SQLquery,strval2);
strcat(SQLquery,",");
...
strcat(SQLquery,strval9);
strcat(SQLquery,")");

bool result= false;
RETCODE rcode;
HENV henv;
HDBC hdbc;
HSTMT hstmt;
unsigned char longStr[256];
short shortStr;
rcode = ::SQLAllocEnv(&henv);
if(rcode==SQL_SUCCESS) {
rcode = ::SQLAllocConnect(henv,&hdbc);
if(rcode==SQL_SUCCESS) {
rcode = ::SQLDriverConnect(hdbc,0,
(unsigned char *)"DSN=SQLResults",
SQL_NTS,longStr,256,&shortStr, //NULL
SQL_DRIVER_NOPROMPT);
if(rcode==SQL_SUCCESS) {
rcode = ::SQLAllocStmt(hdbc,&hstmt);
if(rcode==SQL_SUCCESS) {
rcode = ::SQLExecDirect(hstmt,
(unsigned char *)SQLquery,SQL_NTS);
if(rcode==SQL_SUCCESS)
result = true;
else
result = false;
::SQLFreeStmt(hstmt,SQL_DROP);
}
::SQLDisconnect(hdbc);
}
::SQLFreeConnect(hdbc);
}
::SQLFreeEnv(henv);
}
return result;
================================================== ==============================
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Named range error smartgal Excel Discussion (Misc queries) 0 April 5th 10 06:24 PM
Expand a Named Range in 2007 Nanette New Users to Excel 2 April 26th 07 10:08 PM
Array as a "named range" - formula ok in cells, but error as "named range" tskogstrom Excel Discussion (Misc queries) 11 December 28th 06 04:44 PM
Named range error Antman Excel Discussion (Misc queries) 3 July 13th 06 02:33 AM
Cannot Expand Named Range - when size of the Range exceeds Snig Excel Discussion (Misc queries) 1 July 7th 05 01:46 PM


All times are GMT +1. The time now is 03:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"