473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

SQL REPLACE VARIABL

RAW
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>


Nov 22 '05 #1
0 720

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
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...
12
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...
6
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? ...
1
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...
9
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...
4
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,...
3
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 ("<", "&" ,...
3
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...
6
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...
5
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.