Originally posted by: Huy
I must write a program like Tack Manager but I don't know how to do. Someone can help me? Please send Email to me at :Huydq5000@Yahoo.com.
Thanks
Originally posted by: Narendra Jain
I want to fetch some data from a database table. For this I run SELECT query with CSQLDirect.ExecuteSQL. Now how can I retrive data from CSQLDirect?
Can any body explain with example?
Thanks
ReplyOriginally posted by: sara
10q in advace...
i wanna connect my access database with odbc...
how can i do?
anyone pls help me...
Originally posted by: james hu
Hi, all gurus:
Merry X'mas.
This is very basic question. I am new in this area.
when I try to use this class, It can't connect my database in Server (GH) in another computer.
can anybody help me?
Thanks in advance.
James
Originally posted by: Stefan K.
Hoi,
first i didn't know how to use this class, after getting some help it woks very fine.
but by reading this messageboard I noticed, that there where many others who had the same problems, so here is a mini example for using variables in a "Insert"-clause and how to get a value from a table after a "Select"-clause
CSQLDirect SQLDirect( "dude" );
SQLDirect.ExecuteSQL("Drop Table Person");
SQLDirect.ExecuteSQL("CREATE TABLE Person (ID varchar,LastName varchar,FirstName varchar,Address varchar)");
SQLDirect.ExecuteSQL("Insert into Person values('1','Muster','Harry','Berlin')");
SQLDirect.ExecuteSQL("Insert into Person values('2','Netz','Horst','Brandenburg')");
int i=3;
char temp[300];
sprintf( temp, "Insert into Person values('%d','Example','J�rg','LDS')", i);
SQLDirect.ExecuteSQL(temp);
if( SQLDirect.ExecuteSQL( "SELECT LastName FROM Person WHERE FirstName='Horst'" )==SQL_SUCCESS )
{
CString Temp;
while( SQLDirect.Fetch()==SQL_SUCCESS )
{
Temp = SQLDirect.GetCol("LastName", "Person");
//Temp has now the value->"Netz"
AfxMessageBox(Temp);
TRACE("%d\n", SQLDirect.GetNumColumns());
}
}
mfg
Stefan K.
Reply
Originally posted by: S.Korean Programmer
CSQLDirect SQLDirect( "TestData" );
if( SQLDirect.ExecuteSQL( "SELECT * FROM Employee" )==SQL_SUCCESS ) {
while( SQLDirect.Fetch()==SQL_SUCCESS ) {
.
// How can I Display the recodset ?? .
}
}
As I know, the "SQLExecDirect()" is not return the
needed recordset from the table. Then, How can I display the recodset.?
Please Help Me....
Originally posted by: Billy
I don't know how to use the SQLPutData correctly. Who can Implement the interface of CSQLDirect?
Reply
Originally posted by: Won Lee
CString CSQLDirect::GetCol( int nCol )
// Due to the nature of the SQL API, repeated calls to the same column will result in a NULL value passed
if( nIndex==-1 ) {
SQLGetData( m_hStmt,nCol,GetColumnType( nCol ),&svData,8192,&cbDataLen );
if(cbDataLen == SQL_NULL_DATA) // <-- added
AddColumn( nCol,svValue );
return svValue;
cbDataLen returns the length of the data available to return or error indicator values like SQL_NULL_DATA.
Like this...
{
CString svValue;
// back into svData. We need to keep track of the columns that have been used already and if so, pass back
// the data stored in our array.
int nIndex=FindColumn( nCol );
// Get the column from the SQL cursor.
UCHAR svData[8192];
SDWORD cbDataLen;
svValue=svData;
svValue.TrimRight();
svValue = _T(""); // <-- added
}
else {
// Get the value from the column array.
svValue=GetColumn( nCol )->m_svValue;
}
}
Hava a nice programming~~!
Originally posted by: Mr.vinvin
Good
ReplyOriginally posted by: tigrisha
Thanks a lot for than class!
SQLDirect excelent works with mySQL database.