Error in Query execution
-
Hi, Can u plz help me to rectify the error. 1)If i write the code as shown below I am getting the correct results SQLCHAR SQL[] = "SELECT EmployeeID,Salary FROM EMPLOYEE WHERE EmpName='tejaswini'"; 2)If I write the code as shown below I am getting an error saying that error in execution. What is the wrong with my code? CStirng Str="tejaswini"; SQLCHAR SQL[] = "SELECT EmployeeID,Salary FROM EMPLOYEE WHERE EmpName=Str"; Plz help me. Thanks in advance;
-
Hi, Can u plz help me to rectify the error. 1)If i write the code as shown below I am getting the correct results SQLCHAR SQL[] = "SELECT EmployeeID,Salary FROM EMPLOYEE WHERE EmpName='tejaswini'"; 2)If I write the code as shown below I am getting an error saying that error in execution. What is the wrong with my code? CStirng Str="tejaswini"; SQLCHAR SQL[] = "SELECT EmployeeID,Salary FROM EMPLOYEE WHERE EmpName=Str"; Plz help me. Thanks in advance;
tejaswini.g wrote:
CStirng Str="tejaswini"; SQLCHAR SQL[] = "SELECT EmployeeID,Salary FROM EMPLOYEE WHERE EmpName=Str";
CString Str;
Str.Format( _T( "SELECT EmployeeID,Salary FROM EMPLOYEE WHERE EmpName=%s" ), _T( "tejaswini" ));SQLCHAR SQL[] = Str; // Maybe you will have to convert this Str to SQLCHAR type.
Nibu thomas A Developer Programming tips[^] My site[^]
-
Hi, Can u plz help me to rectify the error. 1)If i write the code as shown below I am getting the correct results SQLCHAR SQL[] = "SELECT EmployeeID,Salary FROM EMPLOYEE WHERE EmpName='tejaswini'"; 2)If I write the code as shown below I am getting an error saying that error in execution. What is the wrong with my code? CStirng Str="tejaswini"; SQLCHAR SQL[] = "SELECT EmployeeID,Salary FROM EMPLOYEE WHERE EmpName=Str"; Plz help me. Thanks in advance;
tejaswini.g wrote:
What is the wrong with my code?
tejaswini.g wrote:
"SELECT EmployeeID,Salary FROM EMPLOYEE WHERE EmpName=Str";
because the SQL engine is executing such query, as is. it is then searching Str as the Employee name...
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
Hi, Can u plz help me to rectify the error. 1)If i write the code as shown below I am getting the correct results SQLCHAR SQL[] = "SELECT EmployeeID,Salary FROM EMPLOYEE WHERE EmpName='tejaswini'"; 2)If I write the code as shown below I am getting an error saying that error in execution. What is the wrong with my code? CStirng Str="tejaswini"; SQLCHAR SQL[] = "SELECT EmployeeID,Salary FROM EMPLOYEE WHERE EmpName=Str"; Plz help me. Thanks in advance;
Si Str va en el texto entrecomillado el ordenador lo interpreta como texto y no como tu variable. Desconozco como funciona un SQLCHAR, si el texto fuera un CString deberías ponerlo así... "SELECT EmployeeID, Salary FROM EMPLOYEE WHERE EmpName='" + Str + "´"; En este caso si cambiará Str por el valor de tu variable, además recuerda que en la sentencia Where EmpName= algo, ese algo tiene que ir entre comillas simples. Espero haberte ayudado.
-
Si Str va en el texto entrecomillado el ordenador lo interpreta como texto y no como tu variable. Desconozco como funciona un SQLCHAR, si el texto fuera un CString deberías ponerlo así... "SELECT EmployeeID, Salary FROM EMPLOYEE WHERE EmpName='" + Str + "´"; En este caso si cambiará Str por el valor de tu variable, además recuerda que en la sentencia Where EmpName= algo, ese algo tiene que ir entre comillas simples. Espero haberte ayudado.
Hablamos inglés aquì señor... :(
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
Hablamos inglés aquì señor... :(
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
i told him that we were speaking english here !
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
i told him that we were speaking english here !
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
toxcct wrote:
i told him that we were speaking english here !
Quite obviously.:)
Nibu thomas A Developer Programming tips[^] My site[^]
-
i told him that we were speaking english here !
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
Si Str va en el texto entrecomillado el ordenador lo interpreta como texto y no como tu variable. Desconozco como funciona un SQLCHAR, si el texto fuera un CString deberías ponerlo así... "SELECT EmployeeID, Salary FROM EMPLOYEE WHERE EmpName='" + Str + "´"; En este caso si cambiará Str por el valor de tu variable, además recuerda que en la sentencia Where EmpName= algo, ese algo tiene que ir entre comillas simples. Espero haberte ayudado.
Thank you. I tried it and am getting error Cannot convert from class CString to unsigned char[]; I tried to convert 'Str' to char variable as shown below; CString csStr(Str); char* pbuff = csStr.GetBuffer(csStr.GetLength()); SQLCHAR SQL[] = "SELECT EmpID,Salary FROM Employee WHERE EmpName='"+pbuff +"'"; Now i am getting the error as "Can not add two pointers" Plz help me to solve the problem. Thanks in advance.
-
-
-
Thank you. I tried it and am getting error Cannot convert from class CString to unsigned char[]; I tried to convert 'Str' to char variable as shown below; CString csStr(Str); char* pbuff = csStr.GetBuffer(csStr.GetLength()); SQLCHAR SQL[] = "SELECT EmpID,Salary FROM Employee WHERE EmpName='"+pbuff +"'"; Now i am getting the error as "Can not add two pointers" Plz help me to solve the problem. Thanks in advance.
tejaswini.g wrote:
SQLCHAR SQL[] = "SELECT EmpID,Salary FROM Employee WHERE EmpName='"+pbuff +"'";
change into this :
SQLCHAR SQL[] = CString("SELECT EmpID,Salary FROM Employee WHERE EmpName='") + csStr + "'";
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]