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.md b" DIM setNiveles AS INTEGER DIM setContenido AS STRING DIM setPagina AS STRING
'requesting my variable forma a querystring
setPagina = Request.QueryString("PAGINA") setNiveles = Request.QueryString("NIVELES") setContenido = Request.QueryString("CONTENIDO") Response.write(setPagina)
******************** 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
try objConnection.open() objDataReader = objCommand.ExecuteReader()
DO WHILE objDataReader.Read()= true
Response.write(objDataReader(setPagina)) Response.write("=") Response.write(objDataReader("NIVELES")) 'Response.write(setNiveles) 'Response.write("&") 'Response.write("Contenido") 'Response.write("=") 'Response.write(setContenido) 'Response.write("&")
loop objDataReader.close() objConnection.close()
Catch e as EXCEPTION end try end Sub
</Script> 2 1366
try
WHERE PAGINA = '" + Replace(setPagina, "'", "''") + "'"
you need to put single quotes after equal sign and between last 2 double
quotes.
Regards,
Rajesh Patel
"RAW" <de****@terra.com> wrote in message
news:ef**************@TK2MSFTNGP12.phx.gbl... 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.md b" DIM setNiveles AS INTEGER DIM setContenido AS STRING DIM setPagina AS STRING
'requesting my variable forma a querystring
setPagina = Request.QueryString("PAGINA") setNiveles = Request.QueryString("NIVELES") setContenido = Request.QueryString("CONTENIDO") Response.write(setPagina)
******************** 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
try objConnection.open() objDataReader = objCommand.ExecuteReader()
DO WHILE objDataReader.Read()= true
Response.write(objDataReader(setPagina)) Response.write("=") Response.write(objDataReader("NIVELES")) 'Response.write(setNiveles) 'Response.write("&") 'Response.write("Contenido") 'Response.write("=") 'Response.write(setContenido) 'Response.write("&")
loop objDataReader.close() objConnection.close()
Catch e as EXCEPTION end try end Sub
</Script>
try
WHERE PAGINA = '" + Replace(setPagina, "'", "''") + "'"
you need to put single quotes after equal sign and between last 2 double
quotes.
Regards,
Rajesh Patel
"RAW" <de****@terra.com> wrote in message
news:ef**************@TK2MSFTNGP12.phx.gbl... 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.md b" DIM setNiveles AS INTEGER DIM setContenido AS STRING DIM setPagina AS STRING
'requesting my variable forma a querystring
setPagina = Request.QueryString("PAGINA") setNiveles = Request.QueryString("NIVELES") setContenido = Request.QueryString("CONTENIDO") Response.write(setPagina)
******************** 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
try objConnection.open() objDataReader = objCommand.ExecuteReader()
DO WHILE objDataReader.Read()= true
Response.write(objDataReader(setPagina)) Response.write("=") Response.write(objDataReader("NIVELES")) 'Response.write(setNiveles) 'Response.write("&") 'Response.write("Contenido") 'Response.write("=") 'Response.write(setContenido) 'Response.write("&")
loop objDataReader.close() objConnection.close()
Catch e as EXCEPTION end try end Sub
</Script> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Craig Keightley |
last post by:
Can these lines of sql statements be consolidated into one sql statement
(possibly using reg exps??)
BEGIN CODE
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Update...
|
by: Barnes |
last post by:
Does anyone know of a good way to use the JavaScript string.replace() method in an ASP form?
Here is the scenario:
I have a form that cannot accept apostrophes. I want to use the replace() so...
|
by: Danny |
last post by:
I need an asp command to strip out from a string all extra punctuation such
as apostrophe, comma, period, spaces dashes, etc etc and just leave the
letters.
Can anybody give me some ideas?
...
|
by: RAW |
last post by:
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...
|
by: Peter Row |
last post by:
Hi,
I know this has been asked before, but reading the threads it is still not
entirely clear.
Deciding which .Replace( ) to use when.
Typically if I create a string in a loop I always use a...
|
by: Cor |
last post by:
Hi Newsgroup,
I have given an answer in this newsgroup about a "Replace".
There came an answer on that I did not understand, so I have done some
tests.
I got the idea that someone said,...
|
by: Goran Djuranovic |
last post by:
Hi all,
I ran into a problem where my XMLTextReader fails on .Read() when I have "<" character in one of the attribute's values. What I am trying to do is replace illegal characters ("<", "&" ,...
|
by: TOXiC |
last post by:
Hi everyone,
First I say that I serched and tryed everything but I cannot figure
out how I can do it.
I want to open a a file (not necessary a txt) and find and replace a
string.
I can do it...
|
by: JackpipE |
last post by:
Here is my replace query and I need to run this on every column in my
table. Right now I manually enter the column name (_LANGUAGES_SPOKEN)
but this is time consuming and would like to automate...
|
by: V S Rawat |
last post by:
I was trying to use back-to-back replace functions to convert a url:
str1 =
str.replace("%2F","/").replace("%3F","?").replace("%3D","=").replace("%2
6","&");
It didn't replace all 4 types of...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |