Click here to Skip to main content
15,909,652 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Print Preview, Zoom and font size? Pin
Paul Barvinko1-Aug-00 7:21
Paul Barvinko1-Aug-00 7:21 
QuestionVC++ ATL Server, VB Client, VARIANTs and SAFEARRAYS ?? Pin
Keith Gemeinhart30-Jul-00 18:03
sussKeith Gemeinhart30-Jul-00 18:03 
AnswerRe: VC++ ATL Server, VB Client, VARIANTs and SAFEARRAYS ?? Pin
Keith Gemeinhart2-Aug-00 5:43
sussKeith Gemeinhart2-Aug-00 5:43 
QuestionWeird error? Pin
howy30-Jul-00 6:14
howy30-Jul-00 6:14 
AnswerRe: Weird error? Pin
howy30-Jul-00 6:14
howy30-Jul-00 6:14 
GeneralRe: Weird error? Pin
Tim Deveaux30-Jul-00 7:43
Tim Deveaux30-Jul-00 7:43 
General*****HELP! PLEASE READ AND HELP***** Pin
Steve Lai30-Jul-00 5:20
Steve Lai30-Jul-00 5:20 
GeneralRe: *****HELP! PLEASE READ AND HELP***** Pin
Erik Thompson30-Jul-00 6:07
sitebuilderErik Thompson30-Jul-00 6:07 
Steve,

For your variables, iterate through the list and build up a string.

// replace following 2 code lines with code to pull values out of the UI you have built up.
char* pszVariables[] = {"Customer_Id", "Price", ...};
char* pszVariableTypes[] = {"INTEGER", "INTEGER", ...};

char** pszCurrentVar = pszVariables;
char** pszCurrentVarType = pszVariablesTypes;

_bstr_t bsVariables = ""; // you can use CString or something else if you want here.

while (pszCurrentVar && pszCurrentVarType && *pszCurrentVar && *pszCurrentVarType)
{
if (bsVariables.length())
{
bsVariables += " , ";
}
bsVariables += *pszCurrentVar;
bsVariables += " ";
bsVariables += *pszCurrentVarType;
pszCurrentVarType++;
pszCurrentVar++;
}

_bstr_t bsQuery;

bsQuery = "CREATE TABLE ";
bsQuery += pszTableName;
bsQuery += " (";
bsQuery += bsVariables;
bsQuery += ")";
// bsQuery now contains CREATE TABLE SQL statement.

// execute CREATE TABLE statement
MyConn.Execute(bsQuery);

Hope this helps,
-Erik
GeneralI don't want to close this dialog Pin
cowell29-Jul-00 14:19
cowell29-Jul-00 14:19 
GeneralRe: I don't want to close this dialog Pin
Tim Deveaux29-Jul-00 17:22
Tim Deveaux29-Jul-00 17:22 
GeneralRe: I don't want to close this dialog Pin
Sam Hobbs31-Jul-00 18:34
Sam Hobbs31-Jul-00 18:34 
QuestionHow do I isolate MFC in a DLL? Pin
Tomb28-Jul-00 9:45
Tomb28-Jul-00 9:45 
AnswerRe: How do I isolate MFC in a DLL? Pin
Erik Funkenbusch1-Aug-00 19:20
Erik Funkenbusch1-Aug-00 19:20 
GeneralHow: Get all the filenames from Open Dialog Pin
Brian28-Jul-00 6:28
Brian28-Jul-00 6:28 
GeneralRe: How: Get all the filenames from Open Dialog Pin
Mike Dunn28-Jul-00 6:55
Mike Dunn28-Jul-00 6:55 
Generaltypedef struct (?) Pin
Frank Deo28-Jul-00 5:37
Frank Deo28-Jul-00 5:37 
GeneralRe: typedef struct (?) Pin
Mike Dunn28-Jul-00 7:01
Mike Dunn28-Jul-00 7:01 
GeneralRe: typedef struct (?) Pin
Frank Deo28-Jul-00 7:59
Frank Deo28-Jul-00 7:59 
GeneralRe: typedef struct (?) Pin
Sam Hobbs31-Jul-00 18:31
Sam Hobbs31-Jul-00 18:31 
GeneralTab control Pin
Roger28-Jul-00 5:35
Roger28-Jul-00 5:35 
GeneralRe: Tab control Pin
Frank Deo28-Jul-00 5:44
Frank Deo28-Jul-00 5:44 
GeneralRe: Tab control Pin
Roger30-Jul-00 9:12
Roger30-Jul-00 9:12 
GeneralRe: Tab control Pin
Frank Deo30-Jul-00 10:13
Frank Deo30-Jul-00 10:13 
GeneralRe: Tab control Pin
ThePilgrim17-Jun-04 20:53
ThePilgrim17-Jun-04 20:53 
GeneralSpell Checking Pin
siva28-Jul-00 4:50
siva28-Jul-00 4:50 

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.