Hi I have a little problem here with my code Iam asp user and Im trying to
use vb.net on this proyect
Im trying to pass varible to the sql string this is my code
<Script language="vb" runat="server">
Sub Page_Load()
'relative connection
'Dim strConnection as String = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source="& _
'Server.MapPath("../NEWMGS/dbcontainer/content.mdb")
'Absolute connection
Dim strConnection as String = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=D:\works\WEBS\NEWMGS\dbcontainer\content.mdb"
DIM setNiveles AS INTEGER
DIM setContenido AS STRING
DIM setPagina AS STRING
********************
HERE RIGHT HERE ITS WHERE I'AM TRYING TO REPLACE THE VARIABLE
setPagina ---------------------------------------------~v
DIM mySqlStatment as string = "Select PAGINA, NIVELES, CONTENIDO, LINKS FROM
content WHERE PAGINA = " + Replace(setPagina, "'", "''") + ""
********************
DIM objConnection AS NEW OledbConnection(strConnection)
DIM objCommand as NEW oledbCommand(mySqlStatment, objConnection)
DIM objDataReader as oledbDataReader
It may help us to know what datatype the PAGINA column is.
It would also help if we knew what error you are getting.
If pagina is meant to be one to the string datatypes
Try this
DIM mySqlStatment as string = String.Format("Select PAGINA, NIVELES,
CONTENIDO, LINKS FROM content WHERE PAGINA = ""{0}""", Replace(setPagina,
"'", "''"))
Hi I try your suggestion to change the + by the & where I concatanate
but I still have the same problem
let me explain when I pass my string with my variable example
whatever.aspx?Pagina=back_0
my page suposed to bring me the data from this record
and my code suppose to replace sql statement with my variable
and I dont know what Iam doing wrong this is not working
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.