Hello everyone

I have a problem, I have this code which works fine me if I use is the
field number but if the data is character sends me an error message
This is the code



     busca =  TextBox1.Text
      Set Archivo = New ADODB.Recordset
      Sqlc = "Driver={SQL
Server};Server=SAPSERVER;Database=INTEGRADORA;Uid=sa;Pwd=B1Admin;"
      Cnn.Open Sqlc
     Sql = "SELECT user_code FROM ousr WHERE user_code= " & busca & ""



"Error en Timepo de ejecucion -2147217900(80040-e14)
invalid Column name '1234'

Value "1234" is the value of the variable busca

Thanks.

--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---

Reply via email to