Click here to Skip to main content
15,896,727 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: USB-to-COM problem in WinXP Home Edition Pin
NiceNaidu13-Jul-06 23:01
NiceNaidu13-Jul-06 23:01 
GeneralRe: USB-to-COM problem in WinXP Home Edition Pin
tctan13-Jul-06 23:08
tctan13-Jul-06 23:08 
QuestionCreate ActiveX from dialog used other ActiveX Pin
majco33313-Jul-06 21:53
majco33313-Jul-06 21:53 
AnswerRe: Create ActiveX from dialog used other ActiveX Pin
NiceNaidu13-Jul-06 22:49
NiceNaidu13-Jul-06 22:49 
GeneralRe: Create ActiveX from dialog used other ActiveX Pin
majco33313-Jul-06 22:58
majco33313-Jul-06 22:58 
GeneralRe: Create ActiveX from dialog used other ActiveX Pin
NiceNaidu13-Jul-06 23:04
NiceNaidu13-Jul-06 23:04 
GeneralRe: Create ActiveX from dialog used other ActiveX Pin
majco33313-Jul-06 23:27
majco33313-Jul-06 23:27 
QuestionEmbedding SQL in C [modified] Pin
Rajiya13-Jul-06 21:46
Rajiya13-Jul-06 21:46 
Hi,
I am trying to run an embeded SQL code using C in the VC++ environment.
I wanted to knw how to bind the DSN with the IP addres so that i can get connected to a remote server.Following is the code: What value should i write for the Data Source?

#include<windows.h>
#include<sqlext.h>
#include<stdio.h>
#include<string.h>
int main(void)
{
HENV hEnv = NULL; // Env Handle from SQLAllocEnv()
HDBC hDBC = NULL; // Connection handle
HSTMT hStmt = NULL;// Statement handle
UCHAR szDSN[SQL_MAX_DSN_LENGTH] = "Provider=SQLOLEDB.1;Persist Security Info=False;Initial Catalog=Northwind;Data Source=10.11.50.15 ";// Data Source Name buffer
UCHAR szUID[10] = "sa";// User ID buffer
UCHAR szPasswd[10] = "mis";// Password buffer

UCHAR szModel[128];// Model buffer
SDWORD cbModel;// Model buffer bytes recieved

char buff[9] = "fgddg";
UCHAR szSqlStr[150]= "INSERT into JON(branch_name, balance)Values ('fgddg',3)" ;

RETCODE retcode;

//sprintf((char*)szSqlStr,"INSERT into (Tablename)(Columname) Values ('%s')",buff);
// Allocate memory for ODBC Environment handle
SQLAllocEnv (&hEnv);

// Allocate memory for the connection handle
SQLAllocConnect (hEnv, &hDBC);

// Connect to the data source "test" using userid and password.
retcode = SQLConnect (hDBC, szDSN, SQL_NTS, szUID, SQL_NTS, szPasswd, SQL_NTS);

if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{
// Allocate memory for the statement handle
retcode = SQLAllocStmt (hDBC, &hStmt);

// Prepare the SQL statement by assigning it to the statement handle
retcode = SQLPrepare (hStmt, szSqlStr, sizeof (szSqlStr));

// Execute the SQL statement handle
retcode = SQLExecute (hStmt);

// Project only column 1 which is the models
SQLBindCol (hStmt, 1, SQL_C_CHAR, szModel, sizeof(szModel), &cbModel);

SQLBindCol (hStmt, 2, SQL_C_FLOAT, szModel, sizeof(szModel), &cbModel);
// Get row of data from the result set defined above in the statement
retcode = SQLFetch (hStmt);

// Free the allocated statement handle
SQLFreeStmt (hStmt, SQL_DROP);


// Disconnect from datasource
SQLDisconnect (hDBC);
}

printf("Done");
// Free the allocated connection handle
SQLFreeConnect (hDBC);

// Free the allocated ODBC environment handle
SQLFreeEnv (hEnv);

return 0;
}

Riz

-- modified at 3:53 Friday 14th July, 2006
AnswerRe: Embedding SQL in C Pin
David Crow14-Jul-06 2:47
David Crow14-Jul-06 2:47 
QuestionWin32 API Pin
Kuroro Rucilful13-Jul-06 21:35
Kuroro Rucilful13-Jul-06 21:35 
AnswerRe: Win32 API Pin
NiceNaidu13-Jul-06 21:40
NiceNaidu13-Jul-06 21:40 
AnswerRe: Win32 API Pin
KarstenK13-Jul-06 22:09
mveKarstenK13-Jul-06 22:09 
AnswerRe: Win32 API Pin
Hamid_RT14-Jul-06 2:14
Hamid_RT14-Jul-06 2:14 
QuestionEnable screen jumping(with condition applied) concepts Pin
Ting Li Che13-Jul-06 21:31
Ting Li Che13-Jul-06 21:31 
Questionmenu item with image Pin
Amit Agarrwal13-Jul-06 20:40
Amit Agarrwal13-Jul-06 20:40 
AnswerRe: menu item with image Pin
*Dreamz13-Jul-06 20:55
*Dreamz13-Jul-06 20:55 
AnswerRe: menu item with image Pin
_AnsHUMAN_ 13-Jul-06 20:55
_AnsHUMAN_ 13-Jul-06 20:55 
AnswerRe: menu item with image Pin
Hamid_RT14-Jul-06 1:49
Hamid_RT14-Jul-06 1:49 
GeneralRe: menu item with image Pin
Amit Agarrwal13-Jul-06 21:20
Amit Agarrwal13-Jul-06 21:20 
GeneralRe: menu item with image Pin
*Dreamz13-Jul-06 21:27
*Dreamz13-Jul-06 21:27 
Questionhow to show other language in list box??? Pin
mimimimilaw13-Jul-06 20:27
mimimimilaw13-Jul-06 20:27 
AnswerRe: how to show other language in list box??? Pin
NiceNaidu13-Jul-06 21:38
NiceNaidu13-Jul-06 21:38 
GeneralRe: how to show other language in list box??? [modified] Pin
mimimimilaw13-Jul-06 21:41
mimimimilaw13-Jul-06 21:41 
QuestionProbelm in linking my library to program Pin
we3Guy13-Jul-06 20:11
we3Guy13-Jul-06 20:11 
AnswerRe: Probelm in linking my library to program Pin
NiceNaidu13-Jul-06 21:29
NiceNaidu13-Jul-06 21:29 

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.