473,378 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

ODBC data base with the VC++

i Am programming to establish connectivity to Mysql server and when setting the attribute to the environment handle the error is invalid valueptr to the attribute.
And also the connection handle is not allocated in version 3.I need help from u ppl.

and also say the sequence , i am totall confused with MSDN.
and here is my code
Expand|Select|Wrap|Line Numbers
  1. ret = SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&envr);
  2.  
  3.  
  4.  if(ret == SQL_SUCCESS  || ret == SQL_SUCCESS_WITH_INFO)
  5.  {
  6.  ret = SQLAllocHandle(SQL_HANDLE_DBC,envr,&hdbc);
  7.  }
  8.  
  9. //if(ret == SQL_SUCCESS  || ret == SQL_SUCCESS_WITH_INFO)
  10.  {
  11.      ret = SQLSetEnvAttr(envr,SQL_ATTR_ODBC_VERSION,prt,20);
  12.  }
  13.   ret = SQLGetDiagRec(SQL_HANDLE_ENV,envr,1,sqlstate,&nativeerror,msg,100,&msglen);
  14.  
  15.  //if(ret == SQL_SUCCESS  || ret == SQL_SUCCESS_WITH_INFO)
  16. {
  17.     ret = SQLSetConnectAttr(&hdbc,SQL_ATTR_LOGIN_TIMEOUT,0,0);
  18. }
  19.  ret = SQLGetDiagRec(SQL_HANDLE_DBC,&hdbc,1,sqlstate,&nativeerror,msg,100,&msglen);
  20.  
  21.  
  22. //if(ret == SQL_SUCCESS  || ret == SQL_SUCCESS_WITH_INFO)
  23. {
  24.     ret = SQLConnect(hdbc,(SQLCHAR*)"pmu",SQL_NTS,(SQLCHAR*)"root",SQL_NTS,(SQLCHAR*)"root",SQL_NTS);
  25. }
  26.  ret = SQLGetDiagRec(SQL_HANDLE_DBC,&hdbc,1,sqlstate,&nativeerror,msg,100,&msglen);
  27.  
  28.  
  29.  
  30.  if(ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO)
  31.  {
  32.  ret = SQLAllocHandle(SQL_HANDLE_STMT,hdbc,&hline);
  33.  }
  34.  if(ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO)
  35.  {
  36.      ret = SQLSetStmtAttr(hline,SQL_ATTR_ROW_BIND_TYPE,sizeof(Ia12),0);
  37.      ret = SQLSetStmtAttr(hline,SQL_ATTR_ROW_ARRAY_SIZE,10,0);
Nov 7 '07 #1
1 2035
sicarie
4,677 Expert Mod 4TB
gnanapoongothai-

You are a member of this community, and as such, are expected to follow the Posting Guidelines in such things as using code tags. Thanks.
Nov 7 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Marco Aschwanden | last post by:
Hi - Win2000 - Python 2.3.3 - py2exe 0.5.0 - eGenix Comercial & Base Package I am developing an app using mxODBC. On the home page they say ...
3
by: Lee | last post by:
Hi, I'm developing a socket program to connect to Informix database through the ODBC. In here i called my socket program as "tap" . My tap will listen for data from unix through port 1070. After...
2
by: Indiana Epilepsy and Child Neurology | last post by:
Before asking this questions I've spent literally _years_ reading (Meyer, Stroustrup, Holub), googling, asking more general design questions, and just plain thinking about it. I am truly unable to...
4
by: Andreas Lauffer | last post by:
Can anyone tell me advantages / disadvantages of DataDirect Server Wire ODBC-driver? Any experiences? What about redistribution? Andreas Lauffer, easySoft. GmbH, Germany
6
by: Rafi Kfir | last post by:
HI, I use vb6 to access database. I can select between "local" data base and "remote" data base. Both connection calls the same Access 2000 Mdb. The Mdb contains local tables (on the hard...
5
by: Alec | last post by:
Hi All, I am currently trying to link in Access 97 to a table in a MSSQL 7 server. Initially the link is fine, however, when I close the access database and re-open it from the same network...
1
by: Simon Bailey | last post by:
In VC++6 I used to use the add member variable tab of the class wizard to bind recordset fields with dialog controls simply by specifying the m_pSet-> variable before the variable name. This all...
1
by: Maileen | last post by:
Hi, I'm writing a VC++.net 2005 application and i would like to use the ODBC connector. I would like to allow user to choose the DB he wants to have (MS SQL, PostgreSQl, MySQL, Oracle,...) by...
11
by: Philip Wagenaar | last post by:
I have an application that can be 'queried' by sending an http post, in return I get an XML file. I have another application that can only work with ODBC. I am asked to write a 'bridge'...
2
by: ram_palavalasa | last post by:
Hi all, I have a assignment of vc++.net and sybase to populate data and generate reports which is the best one? is OLEDB more efficient than ODBC? i think OLEDB itself is a layer on the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.