I noticed a problem reading the table if I change the value of the first number in Field_2 to a text value by inserting a ' in front of it, only reads in the first value of Field_2. Why?
Also, if you change the last two numbers in Field_2 to text values likewise, it only reads the first number.
It only reads the DATA TYPE OF THE FIRST VALUE in Field_2 for the column Field_2.
I noticed this because my app is reading numerical values and text values from the Excel file.
Why does it do this with mixed data types? (numerical&text)
This is on Windows2000.
However, on Windows XP, it works correctly. Is this and ODBC bug or a flaw of the code?
I am new to database programming. I am using the OLE DB method with Visual C++ and MS SQL 7.0. So far I have been able to do everything with VC++ except create relationships between the tables. If anyone has a turorial that explains how to do this, I would be very greatful if you would post it or e-mail it to me.
i have type out this codes (below). when i debug it, the error message keeps on saying that "Wend without While".. can u help me please?? thanks a million..
Private Sub cmdEnter_Click()
Dim temp As String
Dim valid As Integer
temp = "SELECT Password FROM USER WHERE LoginId = '" & txtName.Text & " '"
While rst.EOF <> True
If rst!Password = txtPassword.Text Then
valid = 1
If valid = 1 Then
MsgBox "Invalid Password", vbCritical, "Log In"
i am a new learner about visual C++. Recently i try to use SQLDirect class to connect to database( SQL server ), in Visual C++ studio GUI, under project menu, i use "add to project" command to put SQLColumn.cpp, SQLColumn.h, SQLDirect.cpp, SQLDirect.h into my project workspace, but after i declare an instance of SQLDirect class, it has some errors, if somebody can help me out?
Here is the code:
First of all, thank you for a very usefull class. It works for me most of the time except this one. My SQL statement looks like the following: "SELECT * FROM EMPLOYEE WHERE LASTNAME LIKE '*SM*'" When I run this SQL statement under SQLView in MS Access, it returns the data that match the criteria. However, SQLDirect.Fetch returns SQL_NO_DATA_FOUND. I'm not sure why. If any of you out there have the answer, I really appreciate it.
// Create a pseudo DSN including the name of the Driver and the Excel file
// so we don�t have to have an explicit DSN installed in our ODBC admin
// Open the database using the former created pseudo DSN
// Allocate the recordset
CRecordset recset( &database );
// Build the SQL string
// Remember to name a section of data in the Excel sheet using "Insert->Names" to be
// able to work with the data like you would with a table in a "real" database. There
// may be more than one table contained in a worksheet.
sSql = "SELECT DEFECTCATEGORY, CATEGORY,COUNT "
"FROM DEFECTS "
"ORDER BY DEFECTCATEGORY";
// Execute that query (implicitly by opening the recordset)
// Browse the result
while( !recset.IsEOF() )
// Read the result line
// Insert result into the list
// m_ctrlList.AddString( sItem1 + " --> "+sItem2 );
// Skip to the next resultline
// Close the database
// A database exception occured. Pop out the details...
AfxMessageBox("Database error: "+e->m_strError);
While executing the program , it gives me error, Could not fine database object DEFeCTS. I have also given a name to selection of data in Excel sheet as DEFECTS. Could anybody suggest me what could be the possible reasons of error.